Valerio_Biscione:

Is this the correct way of doing so? I would assume that, since I would probably get an error if it wasn’t.


Yes, it should be the right way. Since you are also changing the first linear layer, you would have a shape mismatch, if you are assigning the new pooling layer to a new attribute (e.g. due to a typo).
Are you using an adaptive optimizer? If not, could you try to lower the learning rate before the spike?
Sometimes when the learning rate is too high, your model might hit these high loss peaks.