Hi there,

I am stuck at the function propagate and it seems I am not the only one. This is what I tried:

def propagate(w, b, X, Y):

m = X.shape[1]

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

loga = np.log(A)

log1minusa = np.log(1-A)

logpart1 = np.dot(Y.T,loga)

logpart2 = np.dot((1-Y).T,log1minusa)

cost = -np.sum(logpart1+logpart2,axis=1)

cost = cost[0]/3

dz = np.abs(A-Y)

dw = np.dot(X,dz.T)

dw = dw / m

db = np.sum(dz,axis=1,dtype=‘float64’)/m

db = db[0]

```
cost = np.squeeze(np.array(cost))
```

and I get the following error when doing the propagate test afterwards:

dw = [[-0.00145353]

[-0.00466444]]

db = 0.0015419373038432329

cost = 1.8015453193941504

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)

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.00145353]

[-0.00466444]] != [[0.99845601]

[2.39507239]]

I tried to go on with the rest but I get stopped by other mistakes, I guess I have to solve that one before. Does anybody see what is my mistake ?

```
grads = {"dw": dw,
"db": db}
return grads, cost
```