- Tensorflow训练FashionMnist数据集报错:
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_input’), name=‘flatten_input’, description=“created by layer ‘flatten_input’”), but it was called on an input with incompatible shape (None, 28).
- 解决方案:
代码修改:
使用reshape(1, 28, 28)
print(np.argmax(model.predict([[(test_images[0]/255).reshape(1, 28, 28)]])))
- 成功运行
模型训练的不错,预测值与标签值相同