A problem about LSTM forward propagation result

When I set the sequence length to 1, Output vector and result [0] are the same.

If the sequence length is not equal to 1 , Output vector is not equal to hidden state vector.
Who can tell me why. And how to calculate the output vector at this time. And what’s the meaning

Could you explain your use case a bit more and post a code snippet so that we can have a look, please?

PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier. :wink:

Please look here pytorch/rnn.py at eae1b40400df2b3e6d777bcaaf60f338749cad0f · pytorch/pytorch · GitHub

The output tensor contain the hidden states for all the sequence lengths and result [1] tensor contain the hidden states just of the very last sequence length .