Week 3 Assignment 2: Input 0 of layer conv2d_transpose_2 is incompatible with the layer Error

Hi All,

I am not able to get past this error in the function “def unet_model(input_size=(96, 128, 3), n_filters=32, n_classes=23)”. It keeps failing with the following output when i run it and I am clueless on what is going wrong with it.

The output I receive is:


Hi, I have the same problem, have you solved it ?

Note that it is only the conv block function that returns two outputs. The upsampling block function only returns one, so you don’t need to index off one element of it as you do with the conv blocks. That’s the reason for the error: by indexing the output of the upsampling block, you’re stripping off one of the expected dimensions.


Thanks Paul. This was helpful.


Hi Eliott, Please refer to the response from Paul, which helped me get past this error. Please let me know if it helps you too.


Paul answer helped me too solving the issue.

1 Like

It’s almost as if Paul can read peoples’ thoughts and know the exact advice to give. Thanks a lot, sir!

It’s not a matter of mind reading: you can actually see the bug in the exception trace. You just have to know what to look for. :nerd_face: It also helps to have seen other people make this same error before.

1 Like