Optimizer.step() vs manual parameter update in RNN tutorial

I’m learning PyTorch and just stumbled upon this in the official tutorial on RNN
the parameter update is encoded in the train function manually, while in the older version of this tutorial on Sean’s github
the optimizer is defined in the usual way and the update is done by calling optimizer.step().

I haven’t found any comments on that in the tutorial. So why manual instead of optimizer?

1 Like

Check out this post:

Essentially, using the optimizer will redefine the RNN when it is called inside the training loop and then update the wrong network weights

1 Like

I spent the last three hours trying to figure out what was wrong. This was perfect thanks!