ayush1999:

loss.backward(retain_g




Possible Problem 1 -  optimizer.zero_grad() should come before loss.backward(retain_graph=True) Or else all of the computer gradients will be Zeroed  and all of the parameters will not be updated.


Possible Problem 2 - Inspect all of your input and make sure none of the sequences contains “NAN”