C2W1A3 Exercise 4 - gradient_check_n, It is not one of the expected values

There is a mistake in the backward propagation! difference = 0.17344196893145924
AssertionError: Wrong value. It is not one of the expected values
What to do, I have no idea.

{moderator edit - solution code removed}

@bahadir @nramon
@eruzanski @aeq @neurogeek

Your code seems correct to me. Try making (2*epsilon) in the calculation of gradapprox[i] float. Use np.float.

I agree the code looks correct. epsilon is already a float, so the type coercion rules should handle 2 * epsilon just fine.

I can think of two theories:

  1. Maybe you modified the fake errors that they put into the back prop function.
  2. Maybe you’re not actually running the version of the code you showed us. Just typing new code into a function cell and then calling it again runs the old code, right? You have to actually click “Shift - Enter” on the modified cell to get the new code loaded. Or try Kernel → Restart and Cell → Run All and see if it works now.