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

hey,
I’m learning PyTorch and just stumbled upon this in the official tutorial on RNN
(https://pytorch.org/tutorials/intermediate/char_rnn_classification_tutorial.html#):
the parameter update is encoded in the train function manually, while in the older version of this tutorial on Sean’s github
(https://github.com/spro/practical-pytorch/blob/master/char-rnn-classification/char-rnn-classification.ipynb)
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!