Could you elaborate on the line hidden = Variable(hidden.data, requires_grad=True)? I don’t understand what Variable is in the code, but I have the same problem in my own network using a GRU. I think your solution will work, but I don’t understand how to apply that specific line. Thanks!