Week 4 - Exercise 9 Error Messages

Hi.

I have been struggling to get this passed for too long. Please help. I also print dAL, caches and related.

caches = (((array([[ 0.09649747, -1.8634927 ],
[-0.2773882 , -0.35475898],
[-0.08274148, -0.62700068],
[-0.04381817, -0.47721803]]), array([[-1.31386475, 0.88462238, 0.88131804, 1.70957306],
[ 0.05003364, -0.40467741, -0.54535995, -1.54647732],
[ 0.98236743, -1.10106763, -1.18504653, -0.2056499 ]]), array([[ 1.48614836],
[ 0.23671627],
[-1.02378514]])), array([[-0.7129932 , 0.62524497],
[-0.16051336, -0.76883635],
[-0.23003072, 0.74505627]])), ((array([[ 1.97611078, -1.24412333],
[-0.62641691, -0.80376609],
[-2.41908317, -0.92379202]]), array([[-1.02387576, 1.12397796, -0.13191423]]), array([[-1.62328545]])), array([[ 0.64667545, -0.35627076]])))
L = 2
dAL =[[-0.5590876 1.77465392]]
current cache = ((array([[ 1.97611078, -1.24412333],
[-0.62641691, -0.80376609],
[-2.41908317, -0.92379202]]), array([[-1.02387576, 1.12397796, -0.13191423]]), array([[-1.62328545]])), array([[ 0.64667545, -0.35627076]]))

UnboundLocalError Traceback (most recent call last)
in
1 t_AL, t_Y_assess, t_caches = L_model_backward_test_case()
----> 2 grads = L_model_backward(t_AL, t_Y_assess, t_caches)
3
4 print("dA0 = " + str(grads[‘dA0’]))
5 print("dA1 = " + str(grads[‘dA1’]))

in L_model_backward(AL, Y, caches)
43 current_cache = caches[L-1]
44 print("current cache = " + str(current_cache))
—> 45 dA_prev_temp, dW_temp, db_temp = linear_activation_backward(dAL, current_cache, activation = “SIGMOID”)
46 grads[“dA” + str(L-1)] = dA_prev_temp
47 grads[“dW” + str(L)] = dW_temp

in linear_activation_backward(dA, cache, activation)
34 dA_prev, dW, db = linear_backward(dZ, linear_cache)
35 # YOUR CODE ENDS HERE
—> 36 return dA_prev, dW, db

UnboundLocalError: local variable ‘dA_prev’ referenced before assignment

Never Mind. I had it passed by changing capital SIGMOID to lower case sigmid. I did the same thing for reel.