thesemicolon icon indicating copy to clipboard operation
thesemicolon copied to clipboard

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

Open anthdm opened this issue 8 years ago • 1 comments

When running the code I get the following error.

Using Theano backend.
model.py:20: UserWarning: Update your `LSTM` call to the Keras 2 API: `LSTM(kernel_initializer="glorot_normal", input_shape=(15,), recurrent_initializer="glorot_normal", units=300, return_sequences=True, activation="sigmoid")`
  model.add(LSTM(output_dim=300,input_shape=x_train.shape[1:],return_sequences=True, init='glorot_normal', inner_init='glorot_normal', activation='sigmoid'))
Traceback (most recent call last):
  File "model.py", line 20, in <module>
    model.add(LSTM(output_dim=300,input_shape=x_train.shape[1:],return_sequences=True, init='glorot_normal', inner_init='glorot_normal', activation='sigmoid'))
  File "/usr/local/lib/python2.7/site-packages/keras/models.py", line 430, in add
    layer(x)
  File "/usr/local/lib/python2.7/site-packages/keras/layers/recurrent.py", line 257, in __call__
    return super(Recurrent, self).__call__(inputs, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/keras/engine/topology.py", line 534, in __call__
    self.assert_input_compatibility(inputs)
  File "/usr/local/lib/python2.7/site-packages/keras/engine/topology.py", line 433, in assert_input_compatibility
    str(K.ndim(x)))
ValueError: Input 0 is incompatible with layer lstm_1: expected ndim=3, found ndim=2  

anthdm avatar May 11 '17 08:05 anthdm

@anthdm : any luck on this?

thomasnt13 avatar Jul 19 '17 10:07 thomasnt13