Working with the OpenNMT-py framework I have come across a puzzling thing. I can only seem to extract a hidden state from a seq2seq LSTM model, not the cell state. The encoder class in onmt/encoders/rnn_encoder.py
returns enc_state, memory_bank, lengths
. The hidden states are in memory_bank
with size [sentence_length,batch_size,hidden_dim].
So where is the cell state?
It’s in enc_state
(as the name suggests) which is the second output of the LSTM layer: