I can’t see why it is happening 'cause the output seems correct. Is it possible that i got the right output the wrong way?
All I did was
dW = 1/m * dot product of dZ and transpose of A_prev
db = do a sum of dz and /m
dA_prev = dot product of W-transpose and dZ
Output:
dA_prev: [[-1.15171336 0.06718465 -0.3204696 2.09812712]
[ 0.60345879 -3.72508701 5.81700741 -3.84326836]
[-0.4319552 -1.30987417 1.72354705 0.05070578]
[-0.38981415 0.60811244 -1.25938424 1.47191593]
[-2.52214926 2.67882552 -0.67947465 1.48119548]]
dW: [[ 0.07313866 -0.0976715 -0.87585828 0.73763362 0.00785716]
[ 0.85508818 0.37530413 -0.59912655 0.71278189 -0.58931808]
[ 0.97913304 -0.24376494 -0.08839671 0.55151192 -0.10290907]]
db: [-0.14713786 -0.11313155 -0.13209101]
Error: Wrong shape for variable 2.
Error: Wrong output for variable 2.
1 Tests passed
2 Tests failed
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-100-3427f65cb756> in <module>
6 print("db: " + str(t_db))
7
----> 8 linear_backward_test(linear_backward)
~/work/release/W4A1/public_tests.py in linear_backward_test(target)
308 ]
309
--> 310 multiple_test(test_cases, target)
311
312 def linear_activation_backward_test(target):
~/work/release/W4A1/test_utils.py in multiple_test(test_cases, target)
140 print('\033[92m', success," Tests passed")
141 print('\033[91m', len(test_cases) - success, " Tests failed")
--> 142 raise AssertionError("Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.".format(target.__name__))
143
AssertionError: Not all tests were passed for linear_backward. Check your equations and avoid using global variables inside the function.```
Expected output:
dA_prev: [[-1.15171336 0.06718465 -0.3204696 2.09812712]
[ 0.60345879 -3.72508701 5.81700741 -3.84326836]
[-0.4319552 -1.30987417 1.72354705 0.05070578]
[-0.38981415 0.60811244 -1.25938424 1.47191593]
[-2.52214926 2.67882552 -0.67947465 1.48119548]]
dW: [[ 0.07313866 -0.0976715 -0.87585828 0.73763362 0.00785716]
[ 0.85508818 0.37530413 -0.59912655 0.71278189 -0.58931808]
[ 0.97913304 -0.24376494 -0.08839671 0.55151192 -0.10290907]]
db: [[-0.14713786]
[-0.11313155]
[-0.13209101]]