Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/strided_slice:0) to a numpy array. T

tensorflow version 2.3.1 numpy version 1.20

below the code

# define model
model = Sequential()
model.add(LSTM(50, activation='relu', input_shape=(n_steps, n_features)))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')

we got

NotImplementedError: Cannot convert a symbolic Tensor (lstm_2/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

it seems to me a crazy error!

like image 663
venergiac Avatar asked Sep 05 '25 10:09

venergiac


1 Answers

I solved with numpy downgrade to 1.18.5

pip install -U numpy==1.18.5
like image 174
venergiac Avatar answered Sep 08 '25 17:09

venergiac