Excercise 3 (gradient_check) function inside Gradient_Checking does not work


The details of the assignment are under:

Assignment: Programming Assignment: Gradient Checking

For the above mentioned exercise notebook I am getting an error in gradient_checking function. The error is as shown:

Due to this I am not getting the required credit and am failing this assignment

This can be avoided if I reformat the code as following:

x, theta = 2, 4
difference = gradient_check(2,4, print_msg=True)


But I am unable to delete the original cell nor am I able to format it

I tried to reset the notebook to its original state using checkpoints but am unable to find its original checkpoint

Please help me to solve this issue



I am still stuck on this only assignment for Week 1. Any assistance could be valuable

Try running all the cells( even the ones in which you dont have to write code)

Hi @Hsadikot , welcome to the DLS !

There is a subtle error in your code. Please look carefully at your code and the code provided for that exercise.

Hi @javier

I understand that there may be error in my code. But I am not allowed to edit that particular cell.

Any way in which I can reset the notebook to its original condition

Hi @Devanshu

I execute each cells but I get the error

Hi @Hsadikot , please send me by direct message the code of your gradient_check function so i can take a look at it.

Hi, @javier.

I had already taken a look at the code. Sorry for not replying sooner.

For other learners experiencing the same error, never write code outside these blocks:



Hey @nramon , at first I also thought that this was the case, but I looked at his implementation and it seemed that the notebook was an old version.

I guided him to update the notebook to the latest release, and now it worked.

1 Like

He did confirm it worked. Thanks, @javier :slight_smile:

1 Like

To all having problem with difference equal to app. 0.9999: do not forget to add appropriate brackets in “gradapprox = …” line (in order to ensure the correct order of caluculations).

1 Like