Cannot convert a symbolic Tensor (lstm_4/strided_slice:0) to a numpy array.

332 views
Skip to first unread message

Shubham Anand

unread,
Oct 8, 2021, 3:17:11 AM10/8/21
to conda - Public
x=np.array(np.arange(200))

from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense
model = Sequential()
model.add(LSTM(10, activation='relu',input_shape=(look_back,1)))
model.add(Dense(1))
model.compile(optimizer='adam', loss='mse')
num_epochs = 100
model.fit_generator(x, epochs=num_epochs, verbose=1)

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


Hi, I have posted my code and error , I am getting this error on model.add(LSTM(....))  line. I tried different version of tensorflow and numpy for sorting this error, but Ithe error remains in all the versions.
If we do  not use model.add (LSTM(...)),the  code works properly.
Please help in cleaning this error.

Thanks ,
Shubham

Peter Wang

unread,
Oct 8, 2021, 8:11:15 AM10/8/21
to Shubham Anand, conda - Public
Hi Shubham,

This is a mailing list for conda-related issues, so you'll need to post this to a Tensorflow or Keras mailing list.

-Peter

--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+un...@anaconda.com.
To view this discussion on the web visit https://groups.google.com/a/anaconda.com/d/msgid/conda/35077e81-3d8b-4f1f-8649-6db512a0be3cn%40anaconda.com.
Reply all
Reply to author
Forward
0 new messages