W 4 A1 | Ex - 5 | linear_cache referenced before assignment


UnboundLocalError Traceback (most recent call last)
in
1 t_X, t_parameters = L_model_forward_test_case_2hidden()
----> 2 t_AL, t_caches = L_model_forward(t_X, t_parameters)
3
4 print("AL = " + str(t_AL))
5

in L_model_forward(X, parameters)
27 # caches …
28 # YOUR CODE STARTS HERE
—> 29 A, cache = linear_activation_forward(A, parameters[‘W’ + str(l)], parameters[‘b’ + str(l)], relu)
30 caches.append(cache)
31 # YOUR CODE ENDS HERE

in linear_activation_forward(A_prev, W, b, activation)
35
36 # YOUR CODE ENDS HERE
—> 37 cache = (linear_cache, activation_cache)
38
39 return A, cache

UnboundLocalError: local variable ‘linear_cache’ referenced before assignment

Everything passes all test until here!

Hello @Florian_Enders! I hope you are doing well.

While implementing linear_activation_forward in L_model_forward, kindly understand that relu is different from "relu".

Best,
Saif.

Thanks, I noticed that too a minute ago!

Still weird that it doesn’t complain about the value NOT being a string!