Skip to content
Advertisement

ValueError: Input 0 of layer conv2d_10 is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: [None, 100, 100]

So I have been following a tutorial about Machine learning and I have come to this point in the code:

JavaScript

When I execute this code it gives me the following Error: ValueError: Input 0 of layer conv2d_10 is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: [None, 100, 100] I have seen multiple posts about this and none have really helped me! Can anyone help?? Thanks in advance!! :)

Advertisement

Answer

Add a reshape since a conv2D layer expects (batch, x, y, channels), (ndim=4) but you are only providing it (batch, x, y), (ndim=3). Just reshape it to (batch, x, y, 1).

Error reads Full shape received: [None, 100, 100]. What it expects is a 4D array [None, 100, 100, 1]

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement