I have a problem with the two_layer_model and get the following error and would appreciate, if anyone could provide me with a hint, what could be wrong.
UnboundLocalError Traceback (most recent call last)
in
----> 1 parameters, costs = two_layer_model(train_x, train_y, layers_dims = (n_x, n_h, n_y), num_iterations = 2, print_cost=False)
2
3 print("Cost after first iteration: " + str(costs[0]))
4
5 two_layer_model_test(two_layer_model)
in two_layer_model(X, Y, layers_dims, learning_rate, num_iterations, print_cost)
49 # YOUR CODE STARTS HERE
50
—> 51 A1, cache1 = linear_activation_forward(X, W1, b1, relu)
52 A2, cache2 = linear_activation_forward(A1, W2, b2, sigmoid)
53
~/work/release/W4A2/dnn_app_utils_v3.py in linear_activation_forward(A_prev, W, b, activation)
209 A, activation_cache = relu(Z)
210
→ 211 assert (A.shape == (W.shape[0], A_prev.shape[1]))
212 cache = (linear_cache, activation_cache)
213
UnboundLocalError: local variable ‘A’ referenced before assignment