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

后端 未结 4 1394
孤街浪徒
孤街浪徒 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条回答
  •  萌比男神i
    2020-12-12 10:11

    I made a diagram. The names follow the PyTorch docs, although I renamed num_layers to w.

    output comprises all the hidden states in the last layer ("last" depth-wise, not time-wise). (h_n, c_n) comprises the hidden states after the last timestep, t = n, so you could potentially feed them into another LSTM.

    The batch dimension is not included.

提交回复
热议问题