I’m not sure how LSTM is implemented, but I think that be default it keeps some state information for each step. 937 is a rather long sequence. There seems to be some ways to circumvent this. Try googling for “pytorch lest sequence length memory detach” or something like that. It has been addressed in some places, but I can’t say that I have fully understood it. Maybe this helps you hunting down your error.