I'm using LSTM to train moving MNIST dataset
I got this error, how to fix it?
Full error message
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_21316\248295683.py in <module>
11 regressor = Sequential()
12 # Adding the first LSTM layer and some Dropout regularisation
---> 13 regressor.add(LSTM(units = 50, return_sequences = True, input_shape = (x_train.shape[1], 1)))
14 regressor.add(Dropout(0.2))
15
c:\Programs\Python\Python37\lib\site-packages\tensorflow\python\training\tracking\base.py in _method_wrapper(self, *args, **kwargs)
520 self._self_setattr_tracking = False # pylint: disable=protected-access
521 try:
--> 522 result = method(self, *args, **kwargs)
523 finally:
524 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
c:\Programs\Python\Python37\lib\site-packages\tensorflow\python\keras\engine\sequential.py in add(self, layer)
211 # and create the node connecting the current layer
212 # to the input layer we just created.
--> 213 layer(x)
214 set_inputs = True
215
c:\Python\Python37\lib\site-packages\tensorflow\python\keras\layers\recurrent.py in __call__(self, inputs, initial_state, constants, **kwargs)
666
...
--> 870 " a NumPy call, which is not supported".format(self.name))
871
872 def __len__(self):
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
Edited
I updated my training code and error message
Training Dataset Shapes: (900, 19, 4096), (900, 19, 4096)
Validation Dataset Shapes: (100, 19, 4096), (100, 19, 4096)
regressor = Sequential()
regressor.add(LSTM(units = 50, return_sequences = True, input_shape = (x_train.shape[1], 1)))
regressor.add(Dropout(0.2))
regressor.add(LSTM(units = 50, return_sequences = True))
regressor.add(Dropout(0.2))
regressor.add(LSTM(units = 50, return_sequences = True))
regressor.add(Dropout(0.2))
regressor.add(LSTM(units = 50))
regressor.add(Dropout(0.2))
regressor.add(Dense(units = 1))
regressor.compile(optimizer = 'adam', loss = 'mean_squared_error')
regressor.fit(x_train, y_train, epochs = 100, batch_size = 32)