C4 - W1 - A1 - E3 - conv_forward

I’m stuck on this error message for hours now.
Can anyone help?

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]
(2, 13, 15, 8)
Error: Wrong output for variable in position 0.
 2  Tests passed
 1  Tests failed
AssertionError                            Traceback (most recent call last)
<ipython-input-134-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)
    118     ]
--> 120     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.

The values for Z[0,2,1] should not be zeros.

Right! There are lots of ways that error could happen, but one that I’ve seen in the past is that the loop indentation was wrong such that the loop over the samples was done completely independent of the other three loops. So you only compute things for the last sample. That gives you non-zero values for the other items, but not for that specific Z value, because it’s for the first sample.

The loops should form a 4 level nested loop. Of course there are probably lots of ways to cause this type of error, but that’s one thing I can suggest to check.

The key point is that indentation is a crucial part of the syntax in python. My personal opinion is that Guido was just being lazy and didn’t want to go to the trouble to implement a real parser, which is why he did it this way. But my opinion doesn’t matter: python is what it is and we all have to “deal with it”. :nerd_face: :scream_cat:

I think the lack of curly-brace use in python syntax is a big defect.

Thanks. I managed to to have all tests passed.

Knowing Z[0,2,1] should not be zeros. (thanks TMosh :blush), I’ve understood that by nested loops where not complete.

I was ranging from 0 to m-1 instead of 0 to m. And so on for every loop.

Thanks again.