Week 1 Ex3 - gradient_check_n

Hey everyone, does anyone know where the problem is here?

For the difference looks like the result of gradient_check_n is array and difference expect single value.

But the problem is reported on line 39 of the gradient_check_n. So, problem must be in the forward_propagation_n or its parameters.

Here is the pre-written code given to you:

# Compute J_plus[i]. Inputs: "parameters_values, epsilon". Output = "J_plus[i]".
# "_" is used because the function you have to outputs two parameters but we only care about the first one
#(approx. 3 lines)
theta_plus =                                        # Step 1
theta_plus[i] =                                     # Step 2
J_plus[i], _ =                                     # Step 3        

Your job is to do your code at the Right-Hand side of the equation and never change the other code. I see, you changed the left-hand side, especially for J_plus[i].

1 Like

Thanks. That solved the problem, but now I’m encountering a new type of problem.
This is the error that I get - I checked my code and cannot find mistake

One common mistake is that students copy the code from the plus and paste it into the minus, without changing the sign.

I checked everything and that isn’t a problem here. Can I send my code to someone to look or is there any other way to fix my problem?

After reviewing the code, here is my comment, as mentioned previously: