|
3 | 3 | importnumpyasnp |
4 | 4 | fromonnximportTensorProto |
5 | 5 |
|
6 | | -withwarnings.catch_warnings(): |
7 | | -warnings.simplefilter("ignore") |
8 | | -fromnumpy.array_api._array_objectimportArray |
| 6 | +try: |
| 7 | +withwarnings.catch_warnings(): |
| 8 | +warnings.simplefilter("ignore") |
| 9 | +fromnumpy.array_api._array_objectimportArray |
| 10 | +exceptImportError: |
| 11 | +Array=None |
9 | 12 | from ..npx.npx_typesimport ( |
10 | 13 | DType, |
11 | 14 | ElemType, |
@@ -107,7 +110,7 @@ def asarray( |
107 | 110 | v=TEagerTensor(np.array(a)) |
108 | 111 | elifisinstance(a,np.ndarray): |
109 | 112 | v=TEagerTensor(a) |
110 | | -elifisinstance(a,Array): |
| 113 | +elifArrayandisinstance(a,Array): |
111 | 114 | v=TEagerTensor(np.asarray(a)) |
112 | 115 | else: |
113 | 116 | raiseRuntimeError(f"Unexpected type{type(a)} for the first input.") |
|