Keras simple RNN implementation

Viewed 3409

I found problems when trying to compile a network with one recurrent layer. It seems there is some issue with the dimensionality of the first layer and thus my understanding of how RNN layers work in Keras.

My code sample is:

model.add(Dense(8,
                input_dim = 2,
                activation = "tanh",
                use_bias = False))
model.add(SimpleRNN(2,
                    activation = "tanh",
                    use_bias = False))
model.add(Dense(1,
                activation = "tanh",
                use_bias = False))

The error is

ValueError: Input 0 is incompatible with layer simple_rnn_1: expected ndim=3, found ndim=2

This error is returned regardless of input_dim value. What am I missing ?

1 Answers
Related