Open amisra2 opened 6 years ago
I recently stumbled into this error.
In my case, a parameter whose value is a numpy array caused the problem. Since node.obj
contains the value associated with the parameter, the equivalence returns a new boolean numpy array containing the element-wise equality between node.obj
and lit
. I thus solved the issue changing the value of the parameter to list, as it implements the equal operator as we expect.
I don't know the implications of the change that you suggest, but it seems that it does not do what it should do. If node.obj
is a numpy array as in my case, node.obj.all
checks if all elements are True or different from zero.. and compare the boolean result of this operation with lit
.
My suggestion is to switch the numpy arrays (parameter values) to lists.
Hi, I am using hyperopt to tune the parameters and I get this error if node.obj == lit: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
However, if I change this statement to if node.obj.all == lit: The code successfully runs. Are there any implications to this change? What could be the possible reason for this? Thanks, Amita