C2W1A3, gradient_checking_n

Hi. I am keep on getting the error shows in the following.


I tried to modify the backward_propagation function and before and after my modification, this value of difference dose not change at all and always the same as the 1_D result! I have spent over 2 hours to figure out what had happened in this cell, and I am sure that I followed every step that provided for us to follow. Is there any possible reason for that? I think I am done for it. Thanks.

update: I rewrite the difference formula in the code every time I modify backward_propogation and it works. But I have no idea why. I tried to describe what I had went through.

When I was debugging, I finaly locate that this code has problem in the function gradient_checking_n:

difference = numerator / denominator

Because I found that when numerator is approximately 4 and denominator is approximately 8, the result is astonishingly approximate to 7.11e-11, which was very bizarre. I tried to rewrite this code by cut and paste and rerun the cell, I found that it works. When I tried to fix the bug in the backward_propagation function, I found that the difference was outputing the result before I modified the function. By rewrote it, which was cut and paste again, it works again. That really bothered me a lot and I have no idea what is happening on this file. If there is any other explanation, I will be grateful for that.

Hey @Gehrman_Yu_74751Xiao,

You kind of lost me at this point. If you don’t mind, can you please DM your notebook to me, so that I can try to run the code myself and try to reproduce the issue.

Cheers,
Elemento

This sounds like maybe you are tripping over the fact that just modifying the code in a function cell and then calling it again does nothing: it just runs the old code again. You have to actually click “Shift-Enter” on the function cell after you modify it in order for the new code to be “compiled” into the runtime image. You can easily demonstrate this to yourself: take a function that works and intentionally break it. Now call it again: it still works, right? Now click “Shift - Enter” on it and then call it again. Kaboom!

In other words all the experiments you were running were simply invalid. The results you were getting did not reflect what you thought they did. It’s analogous to Galileo proving that the speed of light is 300 mph by running an experiment with two people with shuttered lanterns on watchtowers a mile apart. :laughing:

Yes, please take a look. Although I have passed all the tests but this is still haunting me.

{Moderator’s Edit: Solution Code Removed}

I will take a look at the next assignment to see if something like that still happened, hopefully not.

Hey @Gehrman_Yu_74751Xiao,
It looks like you had been doing what Paul Sir described, since no matter what I do, I am not able to reproduce any such issue.

P.S. - Posting solution code publicly is strictly against the community guidelines. Please refrain from doing so in the future.

Cheers,
Elemento

OK, I was posting to wait for received and hope no one saw that.

Hey @Gehrman_Yu_74751Xiao,
No harm done as I have removed the code. I just wanted to let you know about this for future references.

Cheers,
Elemento