fotinidelig:

Could the fact that I’m calling optimizer.step() on the w parameter affect the model (since it has parameters and gradients)?


That may be it. Did you try commenting out optimizer.step() to see if the predictions still differ?