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

后端 未结 4 1396
孤街浪徒
孤街浪徒 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:17

    It really depends on a model you use and how you will interpret the model. Output may be:

    • a single LSTM cell hidden state
    • several LSTM cell hidden states
    • all the hidden states outputs

    Output, is almost never interpreted directly. If the input is encoded there should be a softmax layer to decode the results.

    Note: In language modeling hidden states are used to define the probability of the next word, p(wt+1|w1,...,wt) =softmax(Wht+b).

提交回复
热议问题