diff --git a/onnx_array_api/npx/npx_array_api.py b/onnx_array_api/npx/npx_array_api.py index 05bfe14..d5b2096 100644 --- a/onnx_array_api/npx/npx_array_api.py +++ b/onnx_array_api/npx/npx_array_api.py @@ -13,7 +13,7 @@ class ArrayApiError(RuntimeError): pass -class ArrayApi: +class BaseArrayApi: """ List of supported method by a tensor. """ @@ -36,145 +36,145 @@ def generic_method(self, method_name, *args: Any, **kwargs: Any) -> Any: f"for class {self.__class__.__name__!r}. " f"Method 'generic_method' can be overwritten " f"as well to change the behaviour " - f"for all methods supported by class ArrayApi." + f"for all methods supported by class BaseArrayApi." ) def numpy(self) -> np.ndarray: return self.generic_method("numpy") - def __neg__(self) -> "ArrayApi": + def __neg__(self) -> "BaseArrayApi": return self.generic_method("__neg__") - def __invert__(self) -> "ArrayApi": + def __invert__(self) -> "BaseArrayApi": return self.generic_method("__invert__") - def __add__(self, ov: "ArrayApi") -> "ArrayApi": + def __add__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__add__", ov) - def __radd__(self, ov: "ArrayApi") -> "ArrayApi": + def __radd__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__radd__", ov) - def __sub__(self, ov: "ArrayApi") -> "ArrayApi": + def __sub__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__sub__", ov) - def __rsub__(self, ov: "ArrayApi") -> "ArrayApi": + def __rsub__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rsub__", ov) - def __mul__(self, ov: "ArrayApi") -> "ArrayApi": + def __mul__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__mul__", ov) - def __rmul__(self, ov: "ArrayApi") -> "ArrayApi": + def __rmul__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rmul__", ov) - def __matmul__(self, ov: "ArrayApi") -> "ArrayApi": + def __matmul__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__matmul__", ov) - def __truediv__(self, ov: "ArrayApi") -> "ArrayApi": + def __truediv__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__truediv__", ov) - def __rtruediv__(self, ov: "ArrayApi") -> "ArrayApi": + def __rtruediv__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rtruediv__", ov) - def __mod__(self, ov: "ArrayApi") -> "ArrayApi": + def __mod__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__mod__", ov) - def __rmod__(self, ov: "ArrayApi") -> "ArrayApi": + def __rmod__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rmod__", ov) - def __pow__(self, ov: "ArrayApi") -> "ArrayApi": + def __pow__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__pow__", ov) - def __rpow__(self, ov: "ArrayApi") -> "ArrayApi": + def __rpow__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rpow__", ov) - def __lt__(self, ov: "ArrayApi") -> "ArrayApi": + def __lt__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__lt__", ov) - def __le__(self, ov: "ArrayApi") -> "ArrayApi": + def __le__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__le__", ov) - def __gt__(self, ov: "ArrayApi") -> "ArrayApi": + def __gt__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__gt__", ov) - def __ge__(self, ov: "ArrayApi") -> "ArrayApi": + def __ge__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__ge__", ov) - def __eq__(self, ov: "ArrayApi") -> "ArrayApi": + def __eq__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__eq__", ov) - def __ne__(self, ov: "ArrayApi") -> "ArrayApi": + def __ne__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__ne__", ov) - def __lshift__(self, ov: "ArrayApi") -> "ArrayApi": + def __lshift__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__lshift__", ov) - def __rshift__(self, ov: "ArrayApi") -> "ArrayApi": + def __rshift__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rshift__", ov) - def __and__(self, ov: "ArrayApi") -> "ArrayApi": + def __and__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__and__", ov) - def __rand__(self, ov: "ArrayApi") -> "ArrayApi": + def __rand__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rand__", ov) - def __or__(self, ov: "ArrayApi") -> "ArrayApi": + def __or__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__or__", ov) - def __ror__(self, ov: "ArrayApi") -> "ArrayApi": + def __ror__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__ror__", ov) - def __xor__(self, ov: "ArrayApi") -> "ArrayApi": + def __xor__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__xor__", ov) - def __rxor__(self, ov: "ArrayApi") -> "ArrayApi": + def __rxor__(self, ov: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("__rxor__", ov) @property - def T(self) -> "ArrayApi": + def T(self) -> "BaseArrayApi": return self.generic_method("T") - def astype(self, dtype: Any) -> "ArrayApi": + def astype(self, dtype: Any) -> "BaseArrayApi": return self.generic_method("astype", dtype) @property - def shape(self) -> "ArrayApi": + def shape(self) -> "BaseArrayApi": return self.generic_method("shape") - def reshape(self, shape: "ArrayApi") -> "ArrayApi": + def reshape(self, shape: "BaseArrayApi") -> "BaseArrayApi": return self.generic_method("reshape", shape) def sum( self, axis: OptParType[TupleType[int]] = None, keepdims: ParType[int] = 0 - ) -> "ArrayApi": + ) -> "BaseArrayApi": return self.generic_method("sum", axis=axis, keepdims=keepdims) def mean( self, axis: OptParType[TupleType[int]] = None, keepdims: ParType[int] = 0 - ) -> "ArrayApi": + ) -> "BaseArrayApi": return self.generic_method("mean", axis=axis, keepdims=keepdims) def min( self, axis: OptParType[TupleType[int]] = None, keepdims: ParType[int] = 0 - ) -> "ArrayApi": + ) -> "BaseArrayApi": return self.generic_method("min", axis=axis, keepdims=keepdims) def max( self, axis: OptParType[TupleType[int]] = None, keepdims: ParType[int] = 0 - ) -> "ArrayApi": + ) -> "BaseArrayApi": return self.generic_method("max", axis=axis, keepdims=keepdims) def prod( self, axis: OptParType[TupleType[int]] = None, keepdims: ParType[int] = 0 - ) -> "ArrayApi": + ) -> "BaseArrayApi": return self.generic_method("prod", axis=axis, keepdims=keepdims) - def copy(self) -> "ArrayApi": + def copy(self) -> "BaseArrayApi": return self.generic_method("copy") - def flatten(self) -> "ArrayApi": + def flatten(self) -> "BaseArrayApi": return self.generic_method("flatten") - def __getitem__(self, index: Any) -> "ArrayApi": + def __getitem__(self, index: Any) -> "BaseArrayApi": return self.generic_method("__getitem__", index) def __setitem__(self, index: Any, values: Any): diff --git a/onnx_array_api/npx/npx_functions.py b/onnx_array_api/npx/npx_functions.py index fb455cc..f335bd0 100644 --- a/onnx_array_api/npx/npx_functions.py +++ b/onnx_array_api/npx/npx_functions.py @@ -8,7 +8,7 @@ from .npx_constants import FUNCTION_DOMAIN from .npx_core_api import cst, make_tuple, npxapi_inline, npxapi_no_inline, var -from .npx_tensors import ArrayApi +from .npx_tensors import BaseArrayApi from .npx_types import ( DType, ElemType, @@ -173,7 +173,7 @@ def asarray( raise RuntimeError("Method 'astype' should be used to change the type.") if order is not None: raise NotImplementedError(f"order={order!r} not implemented.") - if isinstance(a, ArrayApi): + if isinstance(a, BaseArrayApi): if copy: return a.__class__(a, copy=copy) return a @@ -404,7 +404,7 @@ def isdtype( dtype: DType, kind: Union[DType, str, Tuple[Union[DType, str], ...]] ) -> bool: """ - See :epkg:`ArrayAPI:isdtype`. + See :epkg:`BaseArrayAPI:isdtype`. This function is not converted into an onnx graph. """ return np_array_api.isdtype(dtype, kind) diff --git a/onnx_array_api/npx/npx_tensors.py b/onnx_array_api/npx/npx_tensors.py index 5863dfe..136def5 100644 --- a/onnx_array_api/npx/npx_tensors.py +++ b/onnx_array_api/npx/npx_tensors.py @@ -3,7 +3,7 @@ import numpy as np from onnx.helper import np_dtype_to_tensor_dtype -from .npx_array_api import ArrayApi, ArrayApiError +from .npx_array_api import BaseArrayApi, ArrayApiError class JitTensor: @@ -14,11 +14,11 @@ class JitTensor: pass -class EagerTensor(ArrayApi): +class EagerTensor(BaseArrayApi): """ Defines a value for a specific eager mode. An eager tensor must overwrite every call to a method listed in class - :class:`ArrayApi`. + :class:`BaseArrayApi`. """ def __iter__(self): @@ -215,7 +215,7 @@ def generic_method(self, method_name, *args: Any, **kwargs: Any) -> Any: return self._generic_method_getitem(method_name, *args, **kwargs) if method_name == "__setitem__": - return ArrayApi.generic_method(self, method_name, *args, **kwargs) + return BaseArrayApi.generic_method(self, method_name, *args, **kwargs) if method_name in {"mean", "sum", "min", "max", "prod"}: return self._generic_method_reduce(method_name, *args, **kwargs) @@ -226,4 +226,4 @@ def generic_method(self, method_name, *args: Any, **kwargs: Any) -> Any: if method_name.startswith("__") and method_name.endswith("__"): return self._generic_method_operator(method_name, *args, **kwargs) - return ArrayApi.generic_method(self, method_name, *args, **kwargs) + return BaseArrayApi.generic_method(self, method_name, *args, **kwargs) diff --git a/onnx_array_api/npx/npx_var.py b/onnx_array_api/npx/npx_var.py index 3b60e01..c67e0ff 100644 --- a/onnx_array_api/npx/npx_var.py +++ b/onnx_array_api/npx/npx_var.py @@ -4,7 +4,7 @@ from onnx import FunctionProto, ModelProto, NodeProto, TensorProto from onnx.helper import np_dtype_to_tensor_dtype -from .npx_array_api import ArrayApi, ArrayApiError +from .npx_array_api import BaseArrayApi, ArrayApiError from .npx_constants import DEFAULT_OPSETS, ONNX_DOMAIN from .npx_types import ElemType, OptParType, ParType, TensorType, TupleType @@ -181,7 +181,7 @@ def to_onnx( return onx -class Var(ArrayApi): +class Var(BaseArrayApi): """ Defines a variable, a result... diff --git a/onnx_array_api/ort/ort_tensors.py b/onnx_array_api/ort/ort_tensors.py index 4f317a5..63bc378 100644 --- a/onnx_array_api/ort/ort_tensors.py +++ b/onnx_array_api/ort/ort_tensors.py @@ -231,7 +231,7 @@ def get_ir_version(cls, ir_version): class EagerOrtTensor(OrtTensor, OrtCommon, EagerTensor): """ - Defines a value for a specific backend. + Defines a value for :epkg:`onnxruntime` as a backend. """ pass @@ -239,7 +239,7 @@ class EagerOrtTensor(OrtTensor, OrtCommon, EagerTensor): class JitOrtTensor(OrtTensor, OrtCommon, JitTensor): """ - Defines a value for a specific backend. + Defines a value for :epkg:`onnxruntime` as a backend. """ pass 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