W2_A2_E5 - "NameError: name 'propagate_test' is not defined"

Hello,
Below error is observed after I entered the code, and executed it.
(Attached picture: Screen Shot 2023-10-10 at 10.54.26 PM.png)
Please assist in resolving the code.
Thanks.


NameError Traceback (most recent call last)
in
14 print ("cost = " + str(cost))
15
—> 16 propagate_test(propagate)

NameError: name ‘propagate_test’ is not defined

The most obvious problem here is probably because you are not running all cells above, especially where the propagate_test function is defined! Thats your starting point.

1 Like

Hi @Anurag_Dixit,

Please post your queries in the right category. You have posted it under General Discussions

Since I know this is from Deep Learning Specialisation, Course 1, I shall move the post there. Please be aware where you post your questions in the future, as this will allow the mentors of that specialisation reply to you promptly.

Thanks,
Mubsi

1 Like

Thanks Gent, Mubsi for the walk-through about four discussion forum.
I followed the step, and getting below ASSERT error.

Is this thread in a public forum? Is there any way I could share my code?
Thanks.


Error:

dw = [[ 0.25071532]
[-0.06604096]]
db = -0.1250040450043965
cost = 7.410349464564118


AssertionError Traceback (most recent call last)
in
14 print ("cost = " + str(cost))
15
—> 16 propagate_test(propagate)

~/work/release/W2A2/public_tests.py in propagate_test(target)
51 assert np.allclose(grads[‘dw’], expected_dw), f"Wrong values for grads[‘dw’]. {grads[‘dw’]} != {expected_dw}"
52 assert np.allclose(grads[‘db’], expected_db), f"Wrong values for grads[‘db’]. {grads[‘db’]} != {expected_db}"
—> 53 assert np.allclose(cost, expected_cost), f"Wrong values for cost. {cost} != {expected_cost}"
54 print(‘\033[92mAll tests passed!’)
55

AssertionError: Wrong values for cost. 12.519827193591215 != 2.0424567983978403

Expected output

dw = [[ 0.25071532]
[-0.06604096]]
db = -0.1250040450043965
cost = 0.15900537707692405

Yes, this is a public thread and you are not supposed to share your code here. If any mentor needs to check your code, that will be done in a private message.

Regarding your error, it says that your propagate function implementation is not correct. Notice that your cost value is different from the expected one. So, double-check how you implementing it.

Yes, notice that your cost value is much higher than the expected value. There are a number of possible reasons for that, but if you used the dot product with transposes, please have a look at this thread and consider whether that applies in your case.