CNN week 3 UNQ_C1

T​he first part for Block1 passes correctly, second Block fails with following message:

I have used n_filters ( conv = Conv2D(n_filters,) in both layers, when
I run, first layer test passes but second layer just gives the
following error:

Test failed

Expected value

[‘Conv2D’, (None, 96, 128, 1024), 28672, ‘same’, ‘relu’, ‘HeNormal’]

does not match the input value:

[‘Conv2D’, (None, 96, 128, 32), 896, ‘same’, ‘relu’, ‘HeNormal’]

AssertionError Traceback (most recent call last)

in

30 print(layer)

31

—> 32 comparator(summary(model2), output2)

/tf/W3A2/test_utils.py in comparator(learner, instructor)

17 “\n\n does not match the input value: \n\n”,

18 colored(f"{a}", “red”))

—> 19 raise AssertionError(“Error in test”)

20 print(colored(“All tests passed!”, “green”))

21

AssertionError: Error in test

Can you please help with a suggestion to resolve this?

It would help if you mention the assignment number and the function name.

You have to do more than just set the n_filters.
You also need to set the kernel_size, activation, padding, and kernel_initializer.
And you have to specify the correct input data for each layer.

Hi, The assignment number is Exercise - 1 conv_block, CNN week 3 second assignment.

Please note as per the instructions of the assignment I have set the following:
In both conv steps kernel_size to 3
padding to ‘same’
kernel_intializer in both steps to ‘he_normal’
for first conv step input is set to (inputs)
for second conv step input is set to (conv)

does this help? would you like me to share a copy of my work?

The inputs are set as follows in def conv_block to inputs=(96,128,3), everything else is set as per assignment

Activation set to ‘relu’

The assert message on Block 2 implies that you may have hard-coded the number of filters in the first Conv2D layer to 32, instead of using the n_filters argument. I say this because the expected value is 1024, but your actual value is 32.

Tom,

Thank you for all your help, all solved and passed