File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 3
3
import numpy as np
4
4
from onnx import TensorProto
5
5
6
- with warnings .catch_warnings ():
7
- warnings .simplefilter ("ignore" )
8
- from numpy .array_api ._array_object import Array
6
+ try :
7
+ with warnings .catch_warnings ():
8
+ warnings .simplefilter ("ignore" )
9
+ from numpy .array_api ._array_object import Array
10
+ except ImportError :
11
+ Array = None
9
12
from ..npx .npx_types import (
10
13
DType ,
11
14
ElemType ,
@@ -107,7 +110,7 @@ def asarray(
107
110
v = TEagerTensor (np .array (a ))
108
111
elif isinstance (a , np .ndarray ):
109
112
v = TEagerTensor (a )
110
- elif isinstance (a , Array ):
113
+ elif Array and isinstance (a , Array ):
111
114
v = TEagerTensor (np .asarray (a ))
112
115
else :
113
116
raise RuntimeError (f"Unexpected type { type (a )} for the first input." )
You can’t perform that action at this time.
0 commit comments