Course4 Week1 Assignment1- Convolutional Model

Hello there,

I’ve been stuck on solving this z’s mean is an incorrect issue for a very long time and I’ve gone through all the threads to check my potential problem. If anyone could give me some suggestion I would be extremely appreciate:)

Here’s the error (the test shows passed though but not the score):

Z's mean =
Z[0,2,1] =
 [-0.05723279  0.03991888 -6.24285862  0.53960581 -5.04059676  6.96991358
  3.69509379 -0.20955895]
cache_conv[0][1][2][3] =
 [-1.1191154   1.9560789  -0.3264995  -1.34267579]
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] 

Second Test: All tests passed!```

Please download your notebook file and send it to me via a private message.

If I read this correctly, the element values of Z[0,2,1] are also incorrect. Unlikely you can correct the Z mean problem without fixing that first. So where are the values of the Z matrix coming from? Slicing, right? I’d go back and look carefully at the indices being used to generate the Z element values via slicing. That, in turn, often leads to examination of the loop controls and proper use of stride. It might be a clue if you look at the two tests, maybe one uses a stride of 1 and the other uses a stride greater than 1? Let us know what you find.

I guess your calculations on “vert_start” and “horiz_start” do not consider the “stride”, and just use “h” and “w” respectively. Please double check what is the right starting point with considering “stride”.

<Update - Add chart just in case…>


Perfect, it’s really helpful, thank you so much, I solved this issue.