What's the difference between “hidden” and “output” in PyTorch LSTM?

后端 未结 4 1390
孤街浪徒
孤街浪徒 2020-12-12 09:47

I\'m having trouble understanding the documentation for PyTorch\'s LSTM module (and also RNN and GRU, which are similar). Regarding the outputs, it says:

4条回答
  •  独厮守ぢ
    2020-12-12 10:20

    The output state is the tensor of all the hidden state from each time step in the RNN(LSTM), and the hidden state returned by the RNN(LSTM) is the last hidden state from the last time step from the input sequence. You could check this by collecting all of the hidden states from each step and comparing that to the output state,(provided you are not using pack_padded_sequence).

提交回复
热议问题