Hello everyone,
In exercise 5 - propagate, I am getting the following output (including some logging output of mine between BEGINNING OF FUNCTION BODY
and END OF FUNCTION BODY
) including an assertion error about the values of dw
:
BEGINNING OF FUNCTION BODY
m: 3
Shape of w: (2, 1)
Shape of X: (2, 3)
Shape of Y: (1, 3)
Shape of Z: (1, 3)
Shape of A: (1, 3)
Shape tmp_cost_val: (1, 3)
Cost: 5.873473260859346
END OF FUNCTION BODY
dw = [[0.93406047]
[2.18899374]]
db = 0.06593791286065272
cost = 5.873473260859346
BEGINNING OF FUNCTION BODY
m: 3
Shape of w: (2, 1)
Shape of X: (2, 3)
Shape of Y: (1, 3)
Shape of Z: (1, 3)
Shape of A: (1, 3)
Shape tmp_cost_val: (1, 3)
Cost: 5.873473260859346
END OF FUNCTION BODY
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-91-be03942b69a5> in <module>
14 print ("cost = " + str(cost))
15
---> 16 propagate_test(propagate)
~/work/release/W2A2/public_tests.py in propagate_test(target)
37 assert type(grads['dw']) == np.ndarray, f"Wrong type for grads['dw']. {type(grads['dw'])} != np.ndarray"
38 assert grads['dw'].shape == w.shape, f"Wrong shape for grads['dw']. {grads['dw'].shape} != {w.shape}"
---> 39 assert np.allclose(grads['dw'], expected_dw), f"Wrong values for grads['dw']. {grads['dw']} != {expected_dw}"
40 assert np.allclose(grads['db'], expected_db), f"Wrong values for grads['db']. {grads['db']} != {expected_db}"
41 assert np.allclose(cost, expected_cost), f"Wrong values for cost. {cost} != {expected_cost}"
AssertionError: Wrong values for grads['dw']. [[0.93406047]
[2.18899374]] != [[0.99845601]
[2.39507239]]
while the expected output should be:
Expected output
dw = [[0.99845601]
[2.39507239]]
db = 0.001455578136784208
cost = 5.801545319394553
So first, there seems to be a mistake with my computation of cost
and then, there seems to be an issue with my gradients dw
and db
. I have tried several different ways of computing cost
and dw
which I would like to show here, but I am not sure if I would violate the coursera honor code then. How should we proceed here?
Thanks a lot for your help.