W1A1 Exercise 5: mismatch in dW_mean and dA_mean

While running " Exercise 5 - conv_backward", I get

dA_mean = 2.161251153616088
dW_mean = 2.4449498930161617
db_mean = 7.839232564616838

while the expected output is:

|dA_mean |1.45243777754|
|dW_mean |1.72699145831|
|db_mean |7.83923256462 |

Question: is the expected output actually correct? Can anyone actually reproduce it (considering that this Exercise is OPTIONAL)?

We have no reports that the expected output is incorrect.

Hello @James_J_Johnson! I hope you are doing.

My output matched the expected output. Kindly check you’ve implemented the code correctly. It is the same as the graded one with minor differences,


This is amazing: I followed the instructions exactly. In fact, a lot of Python lines are already provided in the instructions. I re-verified them in my code. I got all dimensions setup correctly, and yet I have a mismatch. Well, it’s OK. No worries.

Is there any way I can send you my code via some kind of Direct Messaging? After all, this assignment is not graded anyway. Then you would give me some kind of a hint.

Yes, you can send me by direct message. Just click my name and then send message…

After looking at your code, I found mistakes in the following code:

vert_start = 
vert_end = 
horiz_start =
horiz_end = 

You are adding h with stride and w with stride. So, for h = 0 and for w = 0, with stride = 2 you may be getting the wrong vert_start and horiz_start (it should be 0 for this case but according to your equation, it is 2). If you did the same for the Graded exercise, have you passed it? I don’t think so.


Oh! Thanks a lot. I made a typo in Exercise 5! My Exercise 3 was correct.
I was looking for a cause in another area of my code, and omitted this segment of my code.

Hi @James_J_Johnson! I am glad you catch it. Making mistakes is normal in the AI journey. Cheers.

Note: Kindly delete the code you shared as this is against the community Honor Code.


I have deleted the code. I was confused and thought that I posted the code to the DM.

Thanks for removing the code. :+1: :+1: :+1: