Hi.  I have the same need.  I want to do truncated backpropagation through time, and want to stop the gradient propagation past the hidden state from T time-steps ago.  My previous approach was just to buffer the last T inputs and do a full computation of the forward pass from t-T to t, but that involves a lot of repeated computation!
I’m looking for a way that I can just take the hidden state variable from T steps ago, and tell torch “don’t backpropagate past this variable!”.  Is there a workaround that allows this?