You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Elementwise equality comparison with zero-length void dtype fails on NumPy 1.21 #19305
>>> import numpy as np
>>> x = np.zeros((3,), np.void)
>>> x == x
/usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:4: FutureWarning: elementwise == comparison failed and returning scalar instead; this will raise an error or perform elementwise comparison in the future.
False
Probably should just fix this local to comparisons, unless you found the issue also in another context? It is not like you can do a whole lot with voids, especially empty ones...
We have only encountered this in comparisons, so that would work for us.
The empty void dtype is convenient for JAX as a logical "placeholder" for arrays with a particular shape that doesn't require allocating memory (the arrays are always zero).
Activity
seberg commentedon Jun 23, 2021
Probably should just fix this local to comparisons, unless you found the issue also in another context? It is not like you can do a whole lot with voids, especially empty ones...
shoyer commentedon Jun 23, 2021
We have only encountered this in comparisons, so that would work for us.
The empty void dtype is convenient for JAX as a logical "placeholder" for arrays with a particular shape that doesn't require allocating memory (the arrays are always zero).
seberg commentedon Jun 24, 2021
Would be nice if you can test gh-19322, just to be sure.
hawkinsp commentedon Jun 24, 2021
@seberg I can confirm that NumPy built at your PR gh-19322 fixes the test failures we saw in the JAX test suite with NumPy 1.21.
Any chance we can get this fix into 1.21.1 if/when that is a thing?
seberg commentedon Jun 24, 2021
Yes, that PR is practically backport only, the whole branch should use different logic in 1.22/2.0
Disable float0 tests that fail under NumPy 1.21.
Disable float0 tests that fail under NumPy 1.21.
Disable float0 tests that fail under NumPy 1.21.