I’m not sure why you are moving the LSTM execution to the DataLoader as it would complicate the state assignments. Wouldn’t it work to use the DataLoader in the common way to yield the samples and use the LSTM as well as the other model inside the DataLoader loop?