DLS Course 4 Week 1 Assignment Convolution Model Application Exercise 2 - convolutional_model

Input 0 of layer max_pooling2d_21 is incompatible with the layer: expected ndim=4, found ndim=5. Full shape received: [1, None, 64, 64, 8].

In my coding, I only specified the parameters of different layers without changing the dimensions. I wonder what caused the dimension change and how to correct it?

In the convolutional model, we are using the Keras Functional API, so you have to be careful not to put the commas at the end of the lines. If you do that, it adds another dimension to the tensors. In the happy model case, we needed those commas, because there we were using the Sequential API, and the commas separate the elements of the list of layers.

For more information about how to use the Sequential and Functional APIs, here’s a really useful thread from a while back that goes through both in some detail. Please have a look!

Thank you so much. My problem is solved now.