My model definition is:
inputs = keras.Input(shape=(28,28))
dense = keras.layers.Dense(64, activation="relu")
x = dense(inputs)
x = keras.layers.Dense(64, activation="relu")(x)
outputs = keras.layers.Dense(10)(x)
model = keras.Model(inputs=inputs, outputs=outputs, name="mnist_model")
And I will train the network with:
model.compile(optimizer="sgd", loss=keras.losses.SparseCategoricalCrossentropy(from_logits=True), metrics=['accuracy'])
history = model.fit(x_train, y_train, batch_size=10, epochs=30, verbose=2)
which x_train's shape is (55000, 28, 28) and y_train's shape is (55000,) and I get this error:
ValueError: Shape mismatch: The shape of labels (received (10, 1)) should equal the shape of logits except for the last dimension (received (10, 28, 10))