Week2 Assignment

Exercise 2. Cost calculation is failing. What is the Value of A calculated? Not printed the expected A value.

It is exercise 5. Not 2.

Please share your full error.

dw = [[ 0.25071532]
[-0.06604096]]
db = -0.1250040450043965
cost = [6.78158907e-05 1.58025661e-01 9.11899793e-04]

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. [3.75577540e-04 5.08619180e-05 4.19465073e-02 2.00008385e+00] != 2.0424567983978403

The cost is supposed to be a scalar value, right? So why did it come out as a 1 x 3 or 1 x 4 vector?