-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
Closed
Labels
00 - Bugcomponent: SIMDIssues in SIMD (fast instruction sets) code or machineryIssues in SIMD (fast instruction sets) code or machinery
Description
Describe the issue:
np.any
on a boolean array where all elements are False
should return False
. This has been the case for the past decade or so, across numerous numpy
versions. However, I recently installed numpy 1.26.2
, and that is not working as expected. For a 1D boolean array of 63 or less elements, all False
, np.any
returns False
. However, if the length is 64 or more, np.any
returns True.
Reproduce the code example:
import numpy as np
Y = np.zeros(63, bool) ; print(np.any(Y)) # prints "False", as expected
Y = np.zeros(64, bool) ; print(np.any(Y)) # prints "True"
Error message:
No response
Python and NumPy Versions:
import sys; print(sys.version)
3.11.6 (main, Dec 11 2023, 15:56:58) [GCC Intel(R) C++ gcc 11.3.1 mode]
print(np.__version__)
1.26.2
Runtime Environment:
[{'numpy_version': '1.26.2',
'python': '3.11.6 (main, Dec 11 2023, 15:56:58) [GCC Intel(R) C++ gcc 11.3.1 '
'mode]',
'uname': uname_result(system='Linux', node='hercules-login-1.hpc.msstate.edu', release='5.14.0-162.12.1.el9_1.0.2.x86_64', version='#1 SMP PREEMPT_DYNAMIC Mon Jan 30 22:14:42 UTC 2023', machine='x86_64')},
{'simd_extensions': {'baseline': ['SSE', 'SSE2', 'SSE3'],
'found': ['SSSE3',
'SSE41',
'POPCNT',
'SSE42',
'AVX',
'F16C',
'FMA3',
'AVX2',
'AVX512F',
'AVX512CD',
'AVX512_SKX',
'AVX512_CLX',
'AVX512_CNL',
'AVX512_ICL'],
'not_found': ['AVX512_KNL']}},
{'filepath': '/apps/spack-managed/gcc-11.3.1/intel-oneapi-mkl-2023.1.0-4cujjco7etbwl34hwrtw3ree7dwhxnci/mkl/2023.1.0/lib/intel64/libmkl_rt.so.
65E6
2',
'internal_api': 'mkl',
'num_threads': 80,
'prefix': 'libmkl_rt',
'threading_layer': 'intel',
'user_api': 'blas',
'version': '2023.1-Product'},
{'filepath': '/apps/spack-managed/gcc-11.3.1/intel-oneapi-compilers-2023.1.0-sb753366rvywq75zeg4ml5k5c72xgj72/compiler/2023.1.0/linux/compiler/lib/intel64_lin/libiomp5.so',
'internal_api': 'openmp',
'num_threads': 80,
'prefix': 'libiomp',
'user_api': 'openmp',
'version': None}]
None
Context for the issue:
np.any()
on an array of False
elements returning False
is a pretty basic functionality of numpy, and behaves as expected in multiple other versions of numpy
across platforms. I rely on that to filter data regularly. So the fact that this breaks in 1.26.2 is very strange and unexpected.
Metadata
Metadata
Assignees
Labels
00 - Bugcomponent: SIMDIssues in SIMD (fast instruction sets) code or machineryIssues in SIMD (fast instruction sets) code or machinery