I Exercise 6, the checker is telling me that i have a dimension mismatch. However, as you can see below:
- I inserted print statements in front of the cited calculations - and these print statement confirm that i DO NOT have a dimension mismatch.
- As you can see, my code executes and generates all the expected results correctly before the checker finds the dimension mismatch error.
Can you pls help me figure out what i am doing wrong?
(1, 3)
(1, 3)
dW1 = [[ 0.00301023 -0.00747267]
[ 0.00257968 -0.00641288]
[-0.00156892 0.003893 ]
[-0.00652037 0.01618243]]
db1 = [[ 0.00176201]
[ 0.00150995]
[-0.00091736]
[-0.00381422]]
dW2 = [[ 0.00078841 0.01765429 -0.00084166 -0.01022527]]
db2 = [[-0.16655712]]
(1, 3)
(1, 7)
ValueError Traceback (most recent call last)
in
7 print ("db2 = "+ str(grads[“db2”]))
8
----> 9 backward_propagation_test(backward_propagation)
~/work/release/W3A1/public_tests.py in backward_propagation_test(target)
175 ‘db2’: np.array([[-0.78032466]])}
176
→ 177 output = target(parameters, cache, X, Y)
178
179 assert type(output[“dW1”]) == np.ndarray, f"Wrong type for dW1. Expected: {np.ndarray}"
in backward_propagation(parameters, cache, X, Y)
47 print(str(A2.shape))
48 print(str(Y.shape))
—> 49 dZ2 = A2 - Y
50 dW2 = 1/m * np.dot(dZ2, A1.T)
51 db2 = 1/m * np.sum(dZ2, axis = 1, keepdims=True)
ValueError: operands could not be broadcast together with shapes (1,3) (1,7)
Expected output
dW1 = [[ 0.00301023 -0.00747267]
[ 0.00257968 -0.00641288]
[-0.00156892 0.003893 ]
[-0.00652037 0.01618243]]
db1 = [[ 0.00176201]
[ 0.00150995]
[-0.00091736]
[-0.00381422]]
dW2 = [[ 0.00078841 0.01765429 -0.00084166 -0.01022527]]
db2 = [[-0.16655712]]
All tests passed!