@kenb There is only one implementation of the propogate() which is reused by the optimize()

The propagate_test() passes with the following output:

dw = [[0.99845601]

[2.39507239]]

db = 0.001455578136784208

cost = 5.801545319394553

All tests passed!

I implemented a second way of calculating the cost using np.sum() which does result in a scalar output but the result from the optimize_test() is the same

## 5.801545319394553

w = [[0.17998823]

[0.07550727]]

b = 0.8098329520228539

dw = [[0.61299061]

[1.31774648]]

db = 0.0633680265420237

Costs = [array(5.80154532)]

5.801545319394553

0.5892317480074818AssertionError Traceback (most recent call last)

in

7 print("Costs = " + str(costs))

8

----> 9 optimize_test(optimize)~/work/release/W2A2/public_tests.py in optimize_test(target)

61 assert type(costs) == list, “Wrong type for costs. It must be a list”

62 assert len(costs) == 2, f"Wrong length for costs. {len(costs)} != 2"

—> 63 assert np.allclose(costs, expected_cost), f"Wrong values for costs. {costs} != {expected_cost}"

64

65 assert type(grads[‘dw’]) == np.ndarray, f"Wrong type for grads[‘dw’]. {type(grads[‘dw’])} != np.ndarray"AssertionError: Wrong values for costs. [array(5.80154532), array(0.58923175)] != [5.80154532, 0.31057104]