Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numpy 2: "The truth value of an empty array is ambiguous." is an an error #3215

Open
jvesely opened this issue Feb 25, 2025 · 0 comments
Open
Assignees
Labels
fixed-in-devel The issue is fixed in 'devel' branch and will be included in the next release

Comments

@jvesely
Copy link
Collaborator

jvesely commented Feb 25, 2025

The original DeprecationWarning:

tests/functions/test_memory.py::TestContentAddressableMemory::test_ContentAddressableMemory_simple_distances
  /Users/runner/work/PsyNeuLink/PsyNeuLink/psyneulink/core/components/functions/stateful/memoryfunctions.py:396: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.
    test_val = np.array([int(np.array(val).item()) if val else 0 for val in value])

turns into an error with Numpy 2:

>       test_val = np.array([int(np.array(val).item()) if val else 0 for val in value])
E       ValueError: The truth value of an empty array is ambiguous. Use `array.size > 0` to check that an array is not empty.

psyneulink/core/components/functions/stateful/memoryfunctions.py:396: ValueError
@jvesely jvesely self-assigned this Feb 25, 2025
jvesely added a commit to jvesely/PsyNeuLink that referenced this issue Feb 26, 2025
…hts to integers

Numpy doesn't like evaluating boolean values of empty arrays.
Numpy <2 issues a warning, Numpy 2 raises an exception.

Closes: PrincetonUniversity#3215

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
@jvesely jvesely added the fixed-in-devel The issue is fixed in 'devel' branch and will be included in the next release label Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed-in-devel The issue is fixed in 'devel' branch and will be included in the next release
Projects
None yet
Development

No branches or pull requests

1 participant