Hello I have this error and couldn’t fix it
the error
IndexError 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)
47 #(approx. 5 lines)
48 current_cache = caches[1]
—> 49 dA_prev_temp, dW_temp, db_temp = linear_activation_backward(grads[“dA” + str(L-1)], current_cache,activation = “relu”)
50 grads[“dA” + str(l)] = dA_prev_temp
51 grads[“dW” + str(l + 1)] = dW_temp
in linear_activation_backward(dA, cache, activation)
19 if activation == “relu”:
20 #(≈ 2 lines of code)
—> 21 dZ = relu_backward(dA, activation_cache)
22 dA_prev, dW, db = linear_backward(dZ, linear_cache)
23 # YOUR CODE STARTS HERE
~/work/release/W4A1/dnn_utils.py in relu_backward(dA, cache)
54
55 # When z <= 0, you should set dz to 0 as well.
—> 56 dZ[Z <= 0] = 0
57
58 assert (dZ.shape == Z.shape)
IndexError: boolean index did not match indexed array along dimension 0; dimension is 3 but corresponding boolean dimension is 1