使用TensorFlow的dataset时发生了Model was constructed with shape (None, 28, 28) 的错误

代码如下,非常简单的使用了mnist的一个学习范例,但是我这里一直报错

img

运行结果及报错内容

WARNING:tensorflow:Model was constructed with shape (None, 28, 28) for input KerasTensor(type_spec=TensorSpec(shape=(None, 28, 28), dtype=tf.float32, name='flatten_19_input'), name='flatten_19_input', description="created by layer 'flatten_19_input'"), but it was called on an input with incompatible shape (28, 28).
感觉应该是输入数据的形状错误,但是不知道该如何解决,希望高人指教

感觉应该是把d_train_image reshape成(-1, 28, 28)吧