Hi there,
I’m trying to implement a time-series prediction rnn and for this I try to construct a stateful model.
Basically because I have a huge sequence I want to reuse states from previous batches instead of having them reset every time. Keras RNN class has a stateful parameter enabling exactly this behavior:

stateful: Boolean (default False). If True, the last state for each sample at index i in a batch will be used as initial state for the sample of index i in the following batch.

I couldn’t find anything similar for pytorch and my attempts to make something like this manually failed so far.
Basically what I try to do is save variable tensors after forward pass and use them as initial state for h and c variables for LSTMCell on the subsequent forward calls.
I’m very new to pytorch so I’m probably doing something very wrong but so far I’m stuck.
I’d really appreciate any hint or any example of stateful RNN in pytorch.