Skip to content

Commit 850ef72

Browse files
committed
Re-enable wrapping unconditionally for NumPy
NumPy 2.0 and 2.1 both have some incompatibilities with the array API (see #167 and #164). Closes #168.
1 parent 184d397 commit 850ef72

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Diff for: array_api_compat/common/_helpers.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def is_ndonnx_array(x):
145145

146146
import ndonnx as ndx
147147

148-
return isinstance(x, ndx.Array)
148+
return isinstance(x, ndx.Array)
149149

150150
def is_dask_array(x):
151151
"""
@@ -340,12 +340,9 @@ def your_function(x, y):
340340
elif use_compat is False:
341341
namespaces.add(np)
342342
else:
343-
# numpy 2.0 has __array_namespace__ and is fully array API
343+
# numpy 2.0+ have __array_namespace__, however, they are not yet fully array API
344344
# compatible.
345-
if hasattr(np.empty(0), '__array_namespace__'):
346-
namespaces.add(np.empty(0).__array_namespace__(api_version=api_version))
347-
else:
348-
namespaces.add(numpy_namespace)
345+
namespaces.add(numpy_namespace)
349346
elif is_cupy_array(x):
350347
if _use_compat:
351348
_check_api_version(api_version)

0 commit comments

Comments
 (0)