Week 1 Notebook 1: conv_forward doesnt pass unit test 1


I am having a hard time trying to figure out whats wrong with my code.

[snippet deleted by mentor]

This code is not passing Test 1 as follows:

First Test: Z’s mean is incorrect. Expected: 0.5511276474566768
Your output: 0.5329033220060434

First Test: Z[0,2,1] is incorrect. Expected: [-2.17796037, 8.07171329, -0.5772704, 3.36286738, 4.48113645, -2.89198428, 10.99288867, 3.03171932]
Your output: [-0.05723279 0.03991888 -6.24285862 0.53960581 -5.04059676 6.96991358
3.69509379 -0.20955895]

How can we solve this problem? Any hints?


The filter need not always move 1 step at a time. Hint: Look at the stride parameter.

Also, your calculation of horiz_end and vert_end are incorrect.

1 Like

Note, in the future please do not post your code on the forum. That’s not allowed by the course community standard.

Posting any error messages or asserts is good, please use a screen capture image (not a text copy-and-paste).

If a mentor needs to see your code, we’ll ask you to send it via a private message.