我将以下内容定义为模型定义。
tf.keras.datasets.mnist
model = keras.models.Sequential([
tf.keras.layers.Conv2D(28, (3,3), activation='relu', input_shape=(28, 28, 1)),
tf.keras.layers.MaxPooling2D((2, 2)),
tf.keras.layers.Conv2D(56, (3,3), activation='relu'),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(64, activation='relu'),
tf.keras.layers.Dense(10, activation='softmax'),
])
model.fit(x_train, y_train, epochs=3) <----error
当我尝试使用我的数据集运行时,会出现以下错误。
ValueError: Input 0 of layer sequential_3 is incompatible with the layer: : expected min_ndim=4, found ndim=3. Full shape received: [32, 28, 28]