We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d235910 commit 2d30901Copy full SHA for 2d30901
array_api_compat/common/_helpers.py
@@ -71,9 +71,7 @@ def your_function(x, y):
71
"""
72
namespaces = set()
73
for x in xs:
74
- if hasattr(x, '__array_namespace__'):
75
- namespaces.add(x.__array_namespace__(api_version=api_version))
76
- elif _is_numpy_array(x):
+ if _is_numpy_array(x):
77
_check_api_version(api_version)
78
if _use_compat:
79
from .. import numpy as numpy_namespace
@@ -97,6 +95,8 @@ def your_function(x, y):
97
95
else:
98
96
import torch
99
namespaces.add(torch)
+ elif hasattr(x, '__array_namespace__'):
+ namespaces.add(x.__array_namespace__(api_version=api_version))
100
101
# TODO: Support Python scalars?
102
raise TypeError(f"{type(x).__name__} is not a supported array type")
0 commit comments