Course 4 W1 Ex3 - Issue with conv_forward, "Wrong output for variable in position 0"

G’day everyone, I’m having an issue with exercise 3 of the Week 1 assignment in DSL course 4. I’m getting the following output when executing the def conv_forward function:

Z's mean =
Z[0,2,1] =
 [-2.17796044  8.07171371 -0.57727064  3.36286763  4.48113637 -2.89198468
 10.99288881  3.03171947]
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-20-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/ in conv_forward_test(target)
    118     ]
--> 120     multiple_test(test_cases, target)

~/work/release/W1A1/ 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.

I’ve read similar topics on this issue and amended a few of my mistakes. However, I still seem to be running into this error. My code essentially follows the same method outlined in this post, and have taken into account the stride when calculating *_start and *_end.

Any insight would be greatly appreciated, thank you!

There are too many areas for possible errors to list in a thread.
{remainder of reply deleted}

I solved the issue. For anyone having this issue in the future and you believe everything is correct, (included stride, etc.), check your conv_single_step() function in the previous part. The function I implemented for it passed the tester, but was actually causing errors in conv_forward(). I fixed it by having another attempt at conv_single_step().

1 Like

So. What was causing the error in your conv_single_step() fonction?