How can I multiply all my model weights that saved in checkpoint by -1?

I want to try multiplying the checkpoint weights by -1 to try to find the best minimum. How can i do this?

Hi @sbht_sbht,

If you want to multiply all weights by 1, you can try something like this,

for param in model.parameters():

Although, I don’t know why multiplying all weights by one will help you find the minimum, given that your model is non-linear this will most likely drastically change your model’s performance.

If you’re trying to maximize a loss value, you multiply the gradients by -1 not the weights.

Thanks! Yeah, I know that, but I just want to try and see what happens