C4W1 CNN step by step grading issues

Hi everyone.

The pool_forward_test(pool_forward) is absent in the cell that tests my function for case #2 so I think that is why I failed the prog assign. My output and expected output is identical however.


That means you need to execute all the previous cells. Try “Cell → Run All Above”. Then run your test cell again. You need to do this every time you close and reopen the notebook or do a “Kernel → Restart”.

OK I just did that (Cell->run all above) and submitted. Let me show you what might still be the issue:

Case 2: stride of 2

A_prev = np.random.randn(2, 5, 5, 3)
hparameters = {“stride” : 2, “f”: 3}

A, cache = pool_forward(A_prev, hparameters)
print(“mode = max”)
print("A.shape = " + str(A.shape))
print(“A[0] =\n”, A[0])

A, cache = pool_forward(A_prev, hparameters, mode = “average”)
print(“mode = average”)
print("A.shape = " + str(A.shape))
print(“A[1] =\n”, A[1])

pool_forward_test(pool_forward) <<<< this line is missing so it doesn’t appear to test my output against the expected output . This statement is however present in the previous cell



Yes, that is just how the test cell works. You have to manually compare your output with the “Expected” output for that case. Please compare carefully: they all need to match, not just most of them. A bug has been filed that they need to beef up these test cases. If you omit the stride in conv_forward and pool_forward, no errors are thrown, but the grader fails.

Thank you. I didn’t notice that my outfit was not exactly the same but the function had passed the first case so it was a little confused. I’ll try again.

Mr. Mielke,

I’m a little stumped. My pool forward function assigns value to the variable stride.

I’m looking at the discrepancy in the outputs but it’s weird that case two fails.

The only difference between the two cases is that a stride of two was used in the second case.

Again I do integrate stride information in my function.



There are right and wrong ways to incorporate the stride. The calculation of vert_start and horiz_start should be the same as in conv_forward, right? Make sure that you do not use the stride in the range of the for loops. As in conv_forward, the stride happens in the input space, not the output space.

Got it! I realized soon after I wrote you, that I needed to incorporate the stride for start of the vertical and horizontal pooling filter.