Hey Tensorflow community
I’m new to this ML package and am stuck on a bug related to the shapes of my tensors.
I’m trying to create a CNN model for speech emotion classification but I am getting the error at the model.fit
stage.
The shapes of the 2 tensors being used are:
x_testcnn shape: (9, 216, 1)
y_test shape: (9, 4)
The full error that I’m getting is:
ValueError Traceback (most recent call last)
<ipython-input-58-bd5fc6744319> in <module>
----> 1 cnnhistory = model.fit(x_traincnn, y_train, batch_size=16, epochs=700, validation_data=(x_testcnn, y_test))
1 frames
/usr/local/lib/python3.8/dist-packages/keras/engine/training.py in tf__train_function(iterator)
13 try:
14 do_return = True
---> 15 retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
16 except:
17 do_return = False
ValueError: in user code:
File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1249, in train_function *
return step_function(self, iterator)
File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1233, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1222, in run_step **
outputs = model.train_step(data)
File "/usr/local/lib/python3.8/dist-packages/keras/engine/training.py", line 1023, in train_step
y_pred = self(x, training=True)
File "/usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py", line 70, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.8/dist-packages/keras/engine/input_spec.py", line 295, in assert_input_compatibility
raise ValueError(
ValueError: Input 0 of layer "sequential_1" is incompatible with the layer: expected shape=(None, 6, 216, 1), found shape=(None, 216, 1)
Any help would be appreciated!
Thanks a lot