我在尝试制作了一个数据集,训练集形状是(130, 59, 7, 7, 3),目标集(130,)
以下是代码部分
```
log_dir = '.\logs'
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)
inputs = keras.layers.Input(shape=(59,7,7,3))
x = keras.layers.Dense(64 activation='relu')(inputs)
x = keras.layers.Dense(64, activation='relu')(x)
predictions = keras.layers.Dense(1)(x)
model = keras.models.Model(inputs=inputs, outputs=predictions)
model.compile(optimizer='adam', loss='mae')
print("================开始训练======================")
model.fit(train_data, train_label,epochs=10,
verbose=1,callbacks=[tensorboard_callback]) # 开始训练
```
以下是报错:
```
32/130 [======>.......................] - ETA: 2sTraceback (most recent call last):
File "D:/tensorflow/tensor_sale.py", line 48, in <module>
verbose=1,callbacks=[tensorboard_callback]) # 开始训练
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 728, in fit
use_multiprocessing=use_multiprocessing)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 324, in fit
total_epochs=epochs)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py", line 123, in run_one_epoch
batch_outs = execution_function(iterator)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\keras\engine\training_v2_utils.py", line 86, in execution_function
distributed_function(input_fn))
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\eager\def_function.py", line 457, in __call__
result = self._call(*args, **kwds)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\eager\def_function.py", line 520, in _call
return self._stateless_fn(*args, **kwds)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\eager\function.py", line 1823, in __call__
return graph_function._filtered_call(args, kwargs) # pylint: disable=protected-access
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\eager\function.py", line 1141, in _filtered_call
self.captured_inputs)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\eager\function.py", line 1224, in _call_flat
ctx, args, cancellation_manager=cancellation_manager)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\eager\function.py", line 511, in call
ctx=ctx)
File "D:\miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\eager\execute.py", line 67, in quick_execute
six.raise_from(core._status_to_exception(e.code, message), None)
File "<string>", line 3, in raise_from
tensorflow.python.framework.errors_impl.InvalidArgumentError: Incompatible shapes: [32,59,7,7,1] vs. [32,1]
[[node loss/dense_2_loss/sub (defined at \miniconda\envs\tensorflow\lib\site-packages\tensorflow_core\python\framework\ops.py:1751) ]] [Op:__inference_distributed_function_991]
```
求帮忙看看咋回事,我是菜鸟一枚。