Reputation: 384
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.
Upvotes: 1
Views: 976