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

Issue

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!

Solution

I solved with numpy downgrade to 1.18.5

pip install -U numpy==1.18.5

Answered By – venergiac

Answer Checked By – Mildred Charles (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *