Please look here pytorch/rnn.py at eae1b40400df2b3e6d777bcaaf60f338749cad0f · pytorch/pytorch · GitHub 1
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 .