Moderator edit: code removed.

## w = np.array([[1.], [2]])

b = 1.5

X = np.array([[1., -2., -1.], [3., 0.5, -3.2]])

Y = np.array([[1, 1, 0]])

grads, cost = propagate(w, b, X, Y)

assert type(grads[“dw”]) == np.ndarray

assert grads[“dw”].shape == (2, 1)

assert type(grads[“db”]) == np.float64

print ("dw = " + str(grads[“dw”]))

print ("db = " + str(grads[“db”]))

print ("cost = " + str(cost))

propagate_test(propagate)

dw = [[-0.08611258]

[-1.40039089]]

db = 0.0010854697265789692

cost = 1.0980507252610077

ValueError 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)

35 expected_output = (expected_grads, expected_cost)

36

—> 37 grads, cost = target( w, b, X, Y)

38

39 assert type(grads[‘dw’]) == np.ndarray, f"Wrong type for grads[‘dw’]. {type(grads[‘dw’])} != np.ndarray"

in propagate(w, b, X, Y)

33 A = sigmoid(np.dot(w.T,X) + b)

34

—> 35 cost = -1/m * np.sum(Y * np.log(A) + (1-Y)*np.log(1-A))

36

37 # YOUR CODE ENDS HERE

ValueError: operands could not be broadcast together with shapes (1,4) (3,)