W1A3 gradient_check_n


I am stuck here. I’ve read the other messages but I am unable to solve it.

I pass the whole theta to the function that computes the dictionary (which I print and seems OK to me) but I am unable to solve the error I got. I attach it in a figure.



The problem is that forward_propagation_n returns two values, right? You can see that two lines above. They tell you how to cope with that in the comments for that section:

        # 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

Uff… Two hours looking at everything and I missed the simplest thing. Thanks a lot.

The first rule of debugging is “believe the error message”. If you don’t understand what it’s telling you, then that’s the first problem you need to solve.

But maybe the more important lesson in this case is “if you think you’re saving yourself time by not reading the instructions carefully, that is generally not a net savings of time.” You save 3 minutes and then waste a couple of hours. They tried to help you by giving the information you needed to avoid stepping on that landmine in the first place. :grinning: