Week 2 Assignment 1, Exercise 3

I’m confused on why I’m getting the following error in the 3rd exercise of assignment 1:

Test failed 
 Expected value 

 ['Conv2D', (None, 15, 15, 256), 16640, 'valid', 'linear', 'GlorotUniform'] 

 does not match the input value: 

 ['Conv2D', (None, 15, 15, 256), 16640, 'same', 'linear', 'GlorotUniform']

I double-checked my implementation several times, only to find that it seems to match the instructions provided. Has anyone else ran into this?

It looks like you specified “same” padding, but the instructions seem to require “valid” padding on that particular layer. Are you sure you checked that in your “double checking” process? I guess you can argue that your dimensions are the same as expected, so it shouldn’t matter (e.g. for a 1 x 1 convolution, the two have the same result). But the test case is being very specific about what it doesn’t like.

Thanks for responding! Yeah, I believe I double-checked and I’m using “valid” as specified. The only portion of my code wherein this would be an option to specify is in the “AVGPOOL” portion, right? Am I mistaken? I’m assuming I’m missing something really silly.

Note that the layer in question is a Conv2D layer not a pooling layer, right? So I think you are looking in the wrong place. We’re doing computer programming here. This kind of detail matters. The difference between , and ; can spoil your whole afternoon.

I’m getting the same error and have run out of ideas.

I looked at all the Conv2D layers and I’m only using “same” padding in the two places the instructions specifically tell me to; exercise 1 component 2, and exercise 2 component 2. Everywhere else I’m using “valid” padding.

Any pointers would be appreciated.

Hi @Marc_Shepard!

Kindly post your full error.

Best,
Saif.

Oh, never mind. The bug was in Jupyter; when I restarted the kernel (rather than just re-running cells from top to bottom) the problem went away. Odd, but I’m good to go now. BTW - here was the full error (which I no longer get):

Test failed
Expected value

[‘Conv2D’, (None, 15, 15, 256), 16640, ‘valid’, ‘linear’, ‘GlorotUniform’]

does not match the input value:

[‘Conv2D’, (None, 15, 15, 256), 16640, ‘same’, ‘linear’, ‘GlorotUniform’]

AssertionError Traceback (most recent call last)
Input In [14], in <cell line: 7>()
3 from outputs import ResNet50_summary
5 model = ResNet50(input_shape = (64, 64, 3), classes = 6)
----> 7 comparator(summary(model), ResNet50_summary)

File /tf/W2A1/test_utils.py:23, in comparator(learner, instructor)
18 if tuple(a) != tuple(b):
19 print(colored(“Test failed”, attrs=[‘bold’]),
20 “\n Expected value \n\n”, colored(f"{b}“, “green”),
21 “\n\n does not match the input value: \n\n”,
22 colored(f”{a}", “red”))
—> 23 raise AssertionError(“Error in test”)
24 print(colored(“All tests passed!”, “green”))

AssertionError: Error in test

I’m happy to post my code as well if you like.

I am glad you were able to solve your problem.
Note: no need to post your code. Posting code is not allowed.

Best,
Saif.

My guess is that you ran afoul of how the notebooks work: just typing new code in a function cell and then calling it again does nothing. It just runs the old code again. You have to actually click “Shift-Enter” on the function itself to get the new code loaded into the runtime image. You can easily demonstrate this to yourself now that you know about it. So when you restarted the kernel and reran everything it made things consistent again.