For LSTM we can retrieve last output and last cell state as below
outputs, state_h, state_c= LSTM(lstm_dim, return_sequences=True, return_state=True)(inputs)
where state_h is the last sequence of outputs; outputs[-1]=state_h and state_c is the last CELL STATE of LSTM.
But with GRU it does not have such an option but only gives which is equivalent to state_h. How do I get state_c the last cell state from Keras GRU?
There is no internal memory in GRU
, which means there is no cell state
.
GRU
, in general directly operate on the hidden state to get the output value. For most of the purpose, GRU
has the same performance as that of LSTM
, while with less computation (less number of parameters).
Feel free to ask question.