Skip to content

Commit 202562c

Browse files
committed
array
"
1 parent 6a70ac5 commit 202562c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

onnx_array_api/array_api/_onnx_common.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33
import numpy as np
44
from onnx import TensorProto
55

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
912
from ..npx.npx_types import (
1013
DType,
1114
ElemType,
@@ -107,7 +110,7 @@ def asarray(
107110
v = TEagerTensor(np.array(a))
108111
elif isinstance(a, np.ndarray):
109112
v = TEagerTensor(a)
110-
elif isinstance(a, Array):
113+
elif Array and isinstance(a, Array):
111114
v = TEagerTensor(np.asarray(a))
112115
else:
113116
raise RuntimeError(f"Unexpected type {type(a)} for the first input.")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy