1

I am trying to build an LSTM to predict the next word in a sentence. But I keep getting an error:

NotImplementedError: Cannot convert a symbolic Tensor (lstm/strided_slice:0) to a numpy array. This error may indicate that you're trying to pass a Tensor to a NumPy call, which is not supported

The only code I've put in so far is this (excluding the imports of libraries)

model=Sequential()
model.add(LSTM(100,input_shape=(5,3590),return_sequences=True))
model.add(BatchNormalization())
model.add(LSTM(50,return_sequences=True))
model.add(BatchNormalization())
model.add(LSTM(25))
model.add(BatchNormalization())
model.add(Flatten())
model.add(Dense(26,activation="softmax"))

I haven't compiled or fitted the model left. I know there is a way to solve this simply by switching either your TensorFlow/Numpy version or your Python version but I was wondering if there was a way to solve this without having to change versions.

Any help would be appreciated.

1 Answer 1

2

Try downgrading to numpy 1.19.5

pip install numpy==1.19.5
Sign up to request clarification or add additional context in comments.

1 Comment

I'm working on an M1 so I can't just uninstall I have to build from the apple provided wheels. Is there anyway I can get the wheel for that version?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.