Hello, I’m stuck at this error in the Matrix version of my code.

AssertionError: Wrong values for grads[‘dw’].

[[-0.00154399] [-0.00492761]] != [[0.99845601] [2.39507239]]

To debug, I wrote the below longhand sample and it also returns the exact same result as the Matrix version of the code. Best part is I already completed this assignment ~4 months ago (then got sidetracked due to work) and that Matrix code is once again identical to my latest Matrix code, with 1 critical difference. The input Y is defined as [[1, 0, 1]] (instead of [[1, 1, 0]] as in the latest assignment). If I use Y [[1, 0, 1]], I get the dw result that the assertion is looking for. Would like to understand what is the mistake I am making. My file from 4 months ago is also in my Coursera drive as Logistic_Regression_with_a_Neural_Network_mindset_2021_10_10_01_16_32.ipynb

…and it passed all checks, and the prior submission was successful. Is this new Y desired value a typo?

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

b = 2.

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

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

z = X[0,0] * w[0,0] + X[1,0] * w[1,0] + b

yh0 = sigmoid(z)

dz0 = yh0 - Y[0,0]

dw00 = dz0 * X[0,0]

dw01 = dz0 * X[1,0]

db0 = dz0

print(z, yh0, dz0, dw00, dw01, db0)

z = X[0,1] * w[0,0] + X[1,1] * w[1,0] + b

yh1 = sigmoid(z)

dz1 = yh1 - Y[0,1]

dw10 = dz1 * X[0,1]

dw11 = dz1 * X[1,1]

db1 = dz1

print(z, yh1, dz1, dw10, dw11, db1)

z = X[0,2] * w[0,0] + X[1,2] * w[1,0] + b

yh2 = sigmoid(z)

dz2 = yh2 - Y[0,2]

dw20 = dz2 * X[0,2]

dw21 = dz2 * X[1,2]

db2 = dz2

print(z, yh2, dz2, dw20, dw21, db2)

dw0 = 1/3 * (dw00 + dw10 + dw20)

dw1 = 1/3 * (dw01 + dw11 + dw21)

print(dw0, dw1)