Week 4 Exercise 9

Hi all,

i seem to be getting an error with my dW2 where its coming out as array rather than a list.

etc dW2 = (array([[-0.39202432, -0.13325855, -0.04601089]]),)

Just wondering if anyone has an idea where i should look.

Thanks.

Hi, could you please post your error log?

In any case, if the error is related with the type of your output I would suggest you to check where they’re calculated and how, e.g.,dW2 is extracted from grads calculated in L_model_forward. So, then, check how grads is generated, in particular the dWx part…

1 Like

Hi Albert, thanks for getting back to me

this is my error, its weird because none of the other tests show an error.

Looking at the error log it seems to be located where you calculate the last layer, i.e. in the section Lth layer (SIGMOID → LINEAR) gradients. Somewhere around here:

# dA_prev_temp, dW_temp, db_temp = ...
# grads["dW" + str(L)] = ...

As the other layer (relu) seems to be calculated properly maybe you can compare this part (sigmoid) with the other layers part. Also, you could print out the shape of what you’re assigning to grads["dW" + str(L)] for this case (sigmoid) and for the other cases (relu).

Thanks for pointing me in the right direction, turns out there was a stay ‘,’ at the end of the line. All working now. Thanks for your help.

Hi, could you please post your error and the correction you made. I have same error and I can’t figure it out.

Hi @Traptii_k, kindly share the error log(traceback) of your query. Thanks.