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


#1

I’m trying to make a NN using only LSTM layers. I’m just a complete novice so I’m not sure where I went wrong with this error. Can someone help? Or at least give me a pointer on how to fix it?


#2

Hi could you please share the data description that you are using along with the model and it’s configuration.
There is dimension mismatch error in your model.
You need to reshape your input using reshape module in DLS.
You may refer to this pic


Regards
Rajat


#3

Here it is. I haven’t uploaded my data yet, so I’m using the IMDB dataset as a dummy, but it basically consists of timeseries arrays of 3600 time steps each with fixed lengths. I’m trying to train the model to categorize each array into 4 (or maybe 3) categories.

I’m basically just bungling all over the place trying to wrap my head around the basic concepts of RNN and machine learning in general, so I’m sorry if I did something facepalmy. :sweat_smile:


#4

Ok so in this case
First of all add a reshape or embeddings layer after the input in order to make your input 3-Dimensional.
In the last layer since it requires output of 2 dimension.
Set return_sequence = False


Regards
Rajat


#5

Thanks. I switched off return_sequence in the last LSTM layer and added an embedding layer (input: 499, output: 4). But now it gives me an “‘int’ object is not callable” error.

EDIT: I took a screenshot: