Thanks for the code but I can’t really run that. Could you modify it to take randon Tensors as input and make it a single script?
One thing that I see is that you reuse the hidden state directly. Maybe you need to clone it? It is quite hard to say without running the code.