LSTM using the prediction of a previous time step as input

In Pytorch, how would you use a prediction from a previous timestep as input into the next timestep? I’m guessing it’s not possible with torch.nn.LSTM ?

In the document, the examples using LSTM look like:

>>> rnn = nn.LSTM(10, 20, 2)
>>> input = torch.randn(5, 3, 10)
>>> h0 = torch.randn(2, 3, 20)
>>> c0 = torch.randn(2, 3, 20)
>>> output, (hn, cn) = rnn(input, (h0, c0))

Where (hn, cn) contains the hidden state and cell state of current LSTM. So you can use (hn, cn) outputed from the previous timestep as the input of LSTM at the next timestep.