0

Adding the input layer and the LSTM layer

model.add(LSTM(units = 4, activation = 'sigmoid', input_shape = (None, 1)))

Error:

NotImplementedError: Cannot convert a symbolic Tensor (lstm_1/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
ForceBru
  • 43,482
  • 10
  • 63
  • 98
  • What's the full error message? – ForceBru Feb 12 '22 at 15:56
  • NotImplementedError Traceback (most recent call last) /tmp/ipykernel_19256/3048822115.py in 1 # adding the input layer and the LSTM layer ----> 2 model.add(LSTM(units = 4, activation = 'sigmoid', input_shape = (None, 1))) ~/anaconda3/lib/python3.8/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs) 515 self._self_setattr_tracking = False # pylint: disable=protected-access 516 try: - – Bikram Maharjan Feb 12 '22 at 16:22
  • Please include additional code; `model` may not be referencing a keras model. I would suspect `model` is actually holding a numpy type, try viewing what type it is with `print(type(model))` or something similar – Jeremy Feb 12 '22 at 16:27
  • print(type(model)) – Bikram Maharjan Feb 12 '22 at 16:38
  • Put the traceback in your question, not in a unreadable comment. – hpaulj Feb 12 '22 at 17:05
  • Did you try downgrading numpy? https://stackoverflow.com/questions/66207609/notimplementederror-cannot-convert-a-symbolic-tensor-lstm-2-strided-slice0-t?rq=1 – Jeremy Feb 12 '22 at 18:19
  • not yet @Jeremy – Bikram Maharjan Feb 13 '22 at 05:39

1 Answers1

0

Please downgrade your Numpy version to 1.19.2 or 1.19.5 for TF 2.4

Note:Default version of 2.8 is Numpy 1.21.5 .