2
votes

I am implementing an LSTM the shape of my train data is (5237162, 99, 1).

I create the model as follows and I encounter the error.

TypeError: call() got an unexpected keyword argument 'input_shape'

I tried upgrading Keras to the latest version from github. Did not work.

LSTM_model = Sequential()
LSTM_model.add(LSTM(256,input_shape=(final_ip.shape[1],final_ip.shape[2])))

Can someone help me out with this?

1
You need to extract and provide a minimal reproducible example, your question as it stands now is considered off-topic without it. Please also take the tour and read How to Ask. - Ulrich Eckhardt
There's no input_shape on LSTM: keras.io/layers/recurrent/#lstm - Caramiriel
Please include full code, I cannot reproduce the problem with the given code. - Dr. Snoopy
@Caramiriel Every layer accepts an input shape, this comes from the base class Layer, just try it. - Dr. Snoopy

1 Answers

1
votes

This is strange! Running your code runs fine in my notebook. I noticed that 'input_shape' is not an argument of LSTM layer as displayed on officially keras

maybe it is a versioning issue!

my versions: keras '2.2.4', tensorflow '1.11.0'

To bypass it you can try functional api:

from keras.layers import Input
input1 = Input(shape =( final_ip.shape[1],final_ip.shape[2] ) )
x = LSTM(256)(input1)

model = Model(input1,x)