1 year ago
#388463
Celestine Akpanoko
ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 1000), found shape=(None, 30
I need help with this error. I am attempting to train my LSTM model after training the neural network and fine-tuning
history = model.fit(XTrain ,yTrain, batch_size=250, epochs=100, validation_split=0.2,
callbacks=[EarlyStopping(monitor='val_loss', patience=10, restore_best_weights=True)])
The image below is the summary of my model:
The Error
Epoch 1/100
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-279-ebad9b5441a6> in <module>()
1 history = model.fit(XTrain ,yTrain, batch_size=250, epochs=100, validation_split=0.2,
----> 2 callbacks=[EarlyStopping(monitor='val_loss', patience=10, restore_best_weights=True)])
1 frames
/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
1145 except Exception as e: # pylint:disable=broad-except
1146 if hasattr(e, "ag_error_metadata"):
-> 1147 raise e.ag_error_metadata.to_exception(e)
1148 else:
1149 raise
ValueError: in user code:
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1021, in train_function *
return step_function(self, iterator)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1010, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 1000, in run_step **
outputs = model.train_step(data)
File "/usr/local/lib/python3.7/dist-packages/keras/engine/training.py", line 859, in train_step
y_pred = self(x, training=True)
File "/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.7/dist-packages/keras/engine/input_spec.py", line 264, in assert_input_compatibility
raise ValueError(f'Input {input_index} of layer "{layer_name}" is '
ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 1000), found shape=(None, 30)
python
tensorflow
keras
lstm
tensorflow2.0
0 Answers
Your Answer