Gradient Checking assignment error!

Hi all

For gradient checking assignment I got the error as copied below. I have no idea what is wrong with my code and solution. Any help would be appreciated.

X, Y, parameters = gradient_check_n_test_case()

cost, cache = forward_propagation_n(X, Y, parameters)
gradients = backward_propagation_n(X, Y, cache)
difference = gradient_check_n(parameters, gradients, X, Y, 1e-7, True)
expected_values = [0.2850931567761623, 1.1890913024229996e-07]
assert not(type(difference) == np.ndarray), “You are not using np.linalg.norm for numerator or denominator”
assert np.any(np.isclose(difference, expected_values
)), “Wrong value. It is not one of the expected values”


TypeError Traceback (most recent call last)
in
3 cost, cache = forward_propagation_n(X, Y, parameters)
4 gradients = backward_propagation_n(X, Y, cache)
----> 5 difference = gradient_check_n(parameters, gradients, X, Y, 1e-7, True)
6 expected_values = [0.2850931567761623, 1.1890913024229996e-07]
7 assert not(type(difference) == np.ndarray), “You are not using np.linalg.norm for numerator or denominator”

TypeError: gradient_check_n() takes from 4 to 5 positional arguments but 6 were given

Note that you filed this question under AI Discussions, which is a generic category. It looks like you are asking about DLS Course 2 Week 1, so I moved it for you by using the little “edit pencil” on the title.

Are you sure you didn’t modify the function definition of the gradient_check_n function? Here’s what it looks like in my notebook:

# GRADED FUNCTION: gradient_check_n

def gradient_check_n(parameters, gradients, X, Y, epsilon=1e-7, print_msg=False):

As you can see the definition includes 6 parameters, 4 of which are positional. Does that look any different in your notebook?

Thank you for checkin it. You are right, I had deleted the last part in the command by mistake and just corrected and it worked.

Can you please help me how to submit the overdue assignment? For the same course, I had previous assignment " Initialization", but it does not allow to submit the assignment. There is no “Submit” button. Any idea?

Thanks
Faeze

The deadlines should just automatically reset. Maybe you are stuck in an old session of the course or something.

If you do “Kernel → Restart and Clear Output”, does the submit button come back? There is a topic about this on the DLS FAQ Thread.

Glad to hear that my suggestion was useful. Just for future reference, it is never a good idea to change any of the function definitions of the graded functions. :scream_cat: