# Keras difference between GRU and GRUCell

In Keras documentation at this page, https://keras.io/layers/recurrent/, I wonder what's the difference between GRU and GRUCell, which one I should use if I'd like to create a GRU recurrent network. Similarly, I have confusion between LSTM and LSTMCell, and RNN and SimpleRNN.

Checking the source code: the class inheritance is like

Layer => RNN
Layer => GRUCell
Layer => LSTMCell

RNN => SimpleRNN
RNN => GRU
RNN => LSTM


Also,

• This question has been answered on SO. – today Jul 9 '18 at 23:51

In GRU/LSTM Cell, there is no option of return_sequences. That means it is just a cell of an unfolded GRU/LSTM unit.

The argument of GRU/LSTM i.e. return_sequences, if return_sequences=True, then returns all the output state of the GRU/LSTM.

GRU/LSTM Cell computes and returns only one timestamp.

But, GRU/LSTM can return sequences of all timestamps.

In Figure 1, the unit in loop is GRU/LSTM. In Figure 2, the cells shown are GRU/LSTM Cell which is an unfolded GRU/LSTM unit.