From 71b7290a4ac31fa28595007fdfa6a4f9ea85c9c4 Mon Sep 17 00:00:00 2001 From: xadupre Date: Mon, 18 Dec 2023 07:14:04 -0800 Subject: [PATCH 1/2] delay import --- onnx_array_api/npx/npx_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/onnx_array_api/npx/npx_functions.py b/onnx_array_api/npx/npx_functions.py index db29ca2..44431bb 100644 --- a/onnx_array_api/npx/npx_functions.py +++ b/onnx_array_api/npx/npx_functions.py @@ -1,5 +1,4 @@ from typing import Tuple, Union -import array_api_compat.numpy as np_array_api import numpy as np from onnx import FunctionProto, ModelProto, NodeProto, TensorProto from onnx.helper import make_tensor, tensor_dtype_to_np_dtype @@ -624,6 +623,7 @@ def isdtype( See :epkg:`BaseArrayAPI:isdtype`. This function is not converted into an onnx graph. """ + import array_api_compat.numpy as np_array_api if isinstance(dtype, DType): dti = tensor_dtype_to_np_dtype(dtype.code) return np_array_api.isdtype(dti, kind) From 147cc1e7b75323b9f69ba6553a60845ebff8ebbb Mon Sep 17 00:00:00 2001 From: xadupre Date: Mon, 18 Dec 2023 07:16:14 -0800 Subject: [PATCH 2/2] lint --- onnx_array_api/npx/npx_functions.py | 1 + 1 file changed, 1 insertion(+) diff --git a/onnx_array_api/npx/npx_functions.py b/onnx_array_api/npx/npx_functions.py index 44431bb..2f547d6 100644 --- a/onnx_array_api/npx/npx_functions.py +++ b/onnx_array_api/npx/npx_functions.py @@ -624,6 +624,7 @@ def isdtype( This function is not converted into an onnx graph. """ import array_api_compat.numpy as np_array_api + if isinstance(dtype, DType): dti = tensor_dtype_to_np_dtype(dtype.code) return np_array_api.isdtype(dti, kind)