predictions = [1 if x > 0.5 else 0 for x in A2]
I am getting an error for this predictione vector. Please Help understand what is wrong
ValueError Traceback (most recent call last)
<ipython-input-70-eb08347ef392> in <module>
1 parameters, t_X = predict_test_case()
2
----> 3 predictions = predict(parameters, t_X)
4 print("Predictions: " + str(predictions))
5
<ipython-input-69-d130e4af21c3> in predict(parameters, X)
20
21 A2,cache = forward_propagation(X, parameters)
---> 22 predictions = [1 if x > 0.5 else 0 for x in A2]
23
24 # YOUR CODE ENDS HERE
<ipython-input-69-d130e4af21c3> in <listcomp>(.0)
20
21 A2,cache = forward_propagation(X, parameters)
---> 22 predictions = [1 if x > 0.5 else 0 for x in A2]
23
24 # YOUR CODE ENDS HERE
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Expected output
Predictions: [[ True False True]]
All tests passed!