Hi,
Do you properly re-initialize the hidden state to make sure it does not backrprop through the previous iterations. Otherwise you will get the error that you see above with trying to backward though the graph multiple times.