'ValueError: Input 0 of layer "model_23" is incompatible with the layer: expected shape=(None, 784), found shape=(50, 28, 28)

image

ValueError: Input 0 of layer "model_23" is incompatible with the layer: expected shape=(None, 784), found shape=(50, 28, 28)



Solution 1:[1]

Data and model must have the same shape!

If your data is (anything, 28, 28), then your model's input shape MUST be (28,28). You cannot use 784.

If your model is input_shape=(784,) or input_dim=784, your data MUST be (anything, 784).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniel Möller