in L_model_forward(X, parameters)
23 for l in range(1, L):
24 A_prev = A
—> 25 A, cache = linear_activation_forward(A_prev,parameters[‘W’+str(l)],parameters[‘b’+str(l)], relu)
26
27 caches.append(cache)
in linear_activation_forward(A_prev, W, b, activation)
29
30
—> 31 cache = (linear_cache, activation_cache)
32
33 return A, cache
UnboundLocalError: local variable ‘linear_cache’ referenced before assignment
Take a look at the logic in linear_activation_forward. That error message means you are not taking either of the “if” branches. Why would that happen? Note that the conditions there are using the string name of the activation function. But what you passed is not a string, but actually a reference (pointer) to the function, right?