DLS Course 4 [Week 1] Exercise 3 - conv_forward

When I try to launch the test for my code in 3rd assignment an error pops up and I get the following output:

Z's mean =
Z[0,2,1] =
 [0. 0. 0. 0. 0. 0. 0. 0.]
cache_conv[0][1][2][3] =
 [-1.1191154   1.9560789  -0.3264995  -1.34267579]
Error: Wrong output for variable in position 0.
 2  Tests passed
 1  Tests failed
AssertionError                            Traceback (most recent call last)
<ipython-input-38-182241fd5e53> in <module>
     11 print("cache_conv[0][1][2][3] =\n", cache_conv[0][1][2][3])
---> 13 conv_forward_test(conv_forward)

~/work/release/W1A1/public_tests.py in conv_forward_test(target)
    382     ]
--> 384     multiple_test(test_cases, target)

~/work/release/W1A1/test_utils.py in multiple_test(test_cases, target)
    151         print('\033[91m', len(test_cases) - success, " Tests failed")
    152         raise AssertionError(
--> 153             "Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.".format(target.__name__))

AssertionError: Not all tests were passed for conv_forward. Check your equations and avoid using global variables inside the function.

Where could the mistake hide?

Hey you seem to have forgotten to either update Z in the loop, or are initialising it with zero again. Can you check what you’ve done for Z?

Hello, I’ve got this error too, can I up the code for you to figure out what’s wrong for me?

I am getting the same error too. DId anyone figure our the reason for this? I also individually ran the three test cases available in public_tests.py and they all ran fine without giving any assertion error. So not sure why this error is occurring. Is it possible that the this is something wrong with the test scripts which are evaluating the code?

@ Demokritus
I could solve the problem. Make sure you have taken care of ‘strides’ during the looping of the convolution (i.e. calculation of the corners horizontal and vertical start and end points).