Week 3- assignment 2

ValueError: Layer conv2d_25 expects 1 inputs, but it received 2 input tensors. Inputs received: [<tf.Tensor ‘max_pooling2d_9/MaxPool:0’ shape=(None, 48, 64, 32) dtype=float32>, <tf.Tensor ‘conv2d_24/Relu:0’ shape=(None, 96, 128, 32) dtype=float32>]

Please can anyone help me ? stuck here since more than hour

@paulinpaloalto can you ?

The segment of code you show looks correct to me. So I suspect the problem is somewhere else. Are you sure that both your conv_block and upsampling_block functions passed their unit tests? How about showing the output you get from those tests. Here’s my conv_block output:

Block 1:
['InputLayer', [(None, 96, 128, 3)], 0]
['Conv2D', (None, 96, 128, 32), 896, 'same', 'relu', 'HeNormal']
['Conv2D', (None, 96, 128, 32), 9248, 'same', 'relu', 'HeNormal']
['MaxPooling2D', (None, 48, 64, 32), 0, (2, 2)]
All tests passed!

Block 2:
['InputLayer', [(None, 96, 128, 3)], 0]
['Conv2D', (None, 96, 128, 1024), 28672, 'same', 'relu', 'HeNormal']
['Conv2D', (None, 96, 128, 1024), 9438208, 'same', 'relu', 'HeNormal']
['Dropout', (None, 96, 128, 1024), 0, 0.1]
['MaxPooling2D', (None, 48, 64, 1024), 0, (2, 2)]
All tests passed!

And here it is for the upsampling_block:

Block 1:
['InputLayer', [(None, 12, 16, 256)], 0]
['Conv2DTranspose', (None, 24, 32, 32), 73760]
['InputLayer', [(None, 24, 32, 128)], 0]
['Concatenate', (None, 24, 32, 160), 0]
['Conv2D', (None, 24, 32, 32), 46112, 'same', 'relu', 'HeNormal']
['Conv2D', (None, 24, 32, 32), 9248, 'same', 'relu', 'HeNormal']
All tests passed!

exact same results :
image

image

and, i dont know why i think that my error comes from these three arguments in yellow

to be honest i couldnt understand this sentence :

Note that you must use the second element of the contractive block i.e before the maxpooling layer.

No, those are correct. That’s what they tell you to do: the second input to the upsampling block is the second output of the corresponding contractive block. I would have written those variable references without the space between the name and the index value, but the way you wrote it is valid python syntax.

The statement about “before the maxpooling layer” is just describing the difference between the first and second output of a contracting block. Have another look at that logic and it should become clear what they mean.

Can i send you with a private message ? i think its prohibited to show entire code here…

Yes, it’s way better to use a DM if you need to share code.

Hi I have the same issue.

All test passed before. The error seems to appear here:

Please could you help me out @paulinpaloalto ?

Thanks in advance.

I found were my error comes from.

You should remember that the return from conv_block() is “tupple” of “next_layer” and “skip_connection”. You need to select either one depending to the layer.

Exactly this was my mistake :slight_smile:

Good to know that you already fixed it !