How to extract the cell state and hidden state from an RNN model in tensorflow?

后端 未结 3 1240
不思量自难忘°
不思量自难忘° 2021-02-09 09:51

I am new to TensorFlow and have difficulties understanding the RNN module. I am trying to extract hidden/cell states from an LSTM. For my code, I am using the implementation fr

3条回答
  •  执笔经年
    2021-02-09 10:44

    One comment about your assumption: the "states" does have only the values of "hidden state" and "memory cell" from last timestep.

    The "outputs" contain the "hidden state" from each time step you want (the size of outputs is [batch_size, seq_len, hidden_size]. So I assume that you want "outputs" variable, not "states". See the documentation.

提交回复
热议问题