Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19f6f8b

Browse files
authored
rename ArrayApi into BaseArrayApi (#16)
1 parent32ad385 commit19f6f8b

File tree

5 files changed

+55
-55
lines changed

5 files changed

+55
-55
lines changed

‎onnx_array_api/npx/npx_array_api.py‎

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class ArrayApiError(RuntimeError):
1313
pass
1414

1515

16-
classArrayApi:
16+
classBaseArrayApi:
1717
"""
1818
List of supported method by a tensor.
1919
"""
@@ -36,145 +36,145 @@ def generic_method(self, method_name, *args: Any, **kwargs: Any) -> Any:
3636
f"for class{self.__class__.__name__!r}. "
3737
f"Method 'generic_method' can be overwritten "
3838
f"as well to change the behaviour "
39-
f"for all methods supported by classArrayApi."
39+
f"for all methods supported by classBaseArrayApi."
4040
)
4141

4242
defnumpy(self)->np.ndarray:
4343
returnself.generic_method("numpy")
4444

45-
def__neg__(self)->"ArrayApi":
45+
def__neg__(self)->"BaseArrayApi":
4646
returnself.generic_method("__neg__")
4747

48-
def__invert__(self)->"ArrayApi":
48+
def__invert__(self)->"BaseArrayApi":
4949
returnself.generic_method("__invert__")
5050

51-
def__add__(self,ov:"ArrayApi")->"ArrayApi":
51+
def__add__(self,ov:"BaseArrayApi")->"BaseArrayApi":
5252
returnself.generic_method("__add__",ov)
5353

54-
def__radd__(self,ov:"ArrayApi")->"ArrayApi":
54+
def__radd__(self,ov:"BaseArrayApi")->"BaseArrayApi":
5555
returnself.generic_method("__radd__",ov)
5656

57-
def__sub__(self,ov:"ArrayApi")->"ArrayApi":
57+
def__sub__(self,ov:"BaseArrayApi")->"BaseArrayApi":
5858
returnself.generic_method("__sub__",ov)
5959

60-
def__rsub__(self,ov:"ArrayApi")->"ArrayApi":
60+
def__rsub__(self,ov:"BaseArrayApi")->"BaseArrayApi":
6161
returnself.generic_method("__rsub__",ov)
6262

63-
def__mul__(self,ov:"ArrayApi")->"ArrayApi":
63+
def__mul__(self,ov:"BaseArrayApi")->"BaseArrayApi":
6464
returnself.generic_method("__mul__",ov)
6565

66-
def__rmul__(self,ov:"ArrayApi")->"ArrayApi":
66+
def__rmul__(self,ov:"BaseArrayApi")->"BaseArrayApi":
6767
returnself.generic_method("__rmul__",ov)
6868

69-
def__matmul__(self,ov:"ArrayApi")->"ArrayApi":
69+
def__matmul__(self,ov:"BaseArrayApi")->"BaseArrayApi":
7070
returnself.generic_method("__matmul__",ov)
7171

72-
def__truediv__(self,ov:"ArrayApi")->"ArrayApi":
72+
def__truediv__(self,ov:"BaseArrayApi")->"BaseArrayApi":
7373
returnself.generic_method("__truediv__",ov)
7474

75-
def__rtruediv__(self,ov:"ArrayApi")->"ArrayApi":
75+
def__rtruediv__(self,ov:"BaseArrayApi")->"BaseArrayApi":
7676
returnself.generic_method("__rtruediv__",ov)
7777

78-
def__mod__(self,ov:"ArrayApi")->"ArrayApi":
78+
def__mod__(self,ov:"BaseArrayApi")->"BaseArrayApi":
7979
returnself.generic_method("__mod__",ov)
8080

81-
def__rmod__(self,ov:"ArrayApi")->"ArrayApi":
81+
def__rmod__(self,ov:"BaseArrayApi")->"BaseArrayApi":
8282
returnself.generic_method("__rmod__",ov)
8383

84-
def__pow__(self,ov:"ArrayApi")->"ArrayApi":
84+
def__pow__(self,ov:"BaseArrayApi")->"BaseArrayApi":
8585
returnself.generic_method("__pow__",ov)
8686

87-
def__rpow__(self,ov:"ArrayApi")->"ArrayApi":
87+
def__rpow__(self,ov:"BaseArrayApi")->"BaseArrayApi":
8888
returnself.generic_method("__rpow__",ov)
8989

90-
def__lt__(self,ov:"ArrayApi")->"ArrayApi":
90+
def__lt__(self,ov:"BaseArrayApi")->"BaseArrayApi":
9191
returnself.generic_method("__lt__",ov)
9292

93-
def__le__(self,ov:"ArrayApi")->"ArrayApi":
93+
def__le__(self,ov:"BaseArrayApi")->"BaseArrayApi":
9494
returnself.generic_method("__le__",ov)
9595

96-
def__gt__(self,ov:"ArrayApi")->"ArrayApi":
96+
def__gt__(self,ov:"BaseArrayApi")->"BaseArrayApi":
9797
returnself.generic_method("__gt__",ov)
9898

99-
def__ge__(self,ov:"ArrayApi")->"ArrayApi":
99+
def__ge__(self,ov:"BaseArrayApi")->"BaseArrayApi":
100100
returnself.generic_method("__ge__",ov)
101101

102-
def__eq__(self,ov:"ArrayApi")->"ArrayApi":
102+
def__eq__(self,ov:"BaseArrayApi")->"BaseArrayApi":
103103
returnself.generic_method("__eq__",ov)
104104

105-
def__ne__(self,ov:"ArrayApi")->"ArrayApi":
105+
def__ne__(self,ov:"BaseArrayApi")->"BaseArrayApi":
106106
returnself.generic_method("__ne__",ov)
107107

108-
def__lshift__(self,ov:"ArrayApi")->"ArrayApi":
108+
def__lshift__(self,ov:"BaseArrayApi")->"BaseArrayApi":
109109
returnself.generic_method("__lshift__",ov)
110110

111-
def__rshift__(self,ov:"ArrayApi")->"ArrayApi":
111+
def__rshift__(self,ov:"BaseArrayApi")->"BaseArrayApi":
112112
returnself.generic_method("__rshift__",ov)
113113

114-
def__and__(self,ov:"ArrayApi")->"ArrayApi":
114+
def__and__(self,ov:"BaseArrayApi")->"BaseArrayApi":
115115
returnself.generic_method("__and__",ov)
116116

117-
def__rand__(self,ov:"ArrayApi")->"ArrayApi":
117+
def__rand__(self,ov:"BaseArrayApi")->"BaseArrayApi":
118118
returnself.generic_method("__rand__",ov)
119119

120-
def__or__(self,ov:"ArrayApi")->"ArrayApi":
120+
def__or__(self,ov:"BaseArrayApi")->"BaseArrayApi":
121121
returnself.generic_method("__or__",ov)
122122

123-
def__ror__(self,ov:"ArrayApi")->"ArrayApi":
123+
def__ror__(self,ov:"BaseArrayApi")->"BaseArrayApi":
124124
returnself.generic_method("__ror__",ov)
125125

126-
def__xor__(self,ov:"ArrayApi")->"ArrayApi":
126+
def__xor__(self,ov:"BaseArrayApi")->"BaseArrayApi":
127127
returnself.generic_method("__xor__",ov)
128128

129-
def__rxor__(self,ov:"ArrayApi")->"ArrayApi":
129+
def__rxor__(self,ov:"BaseArrayApi")->"BaseArrayApi":
130130
returnself.generic_method("__rxor__",ov)
131131

132132
@property
133-
defT(self)->"ArrayApi":
133+
defT(self)->"BaseArrayApi":
134134
returnself.generic_method("T")
135135

136-
defastype(self,dtype:Any)->"ArrayApi":
136+
defastype(self,dtype:Any)->"BaseArrayApi":
137137
returnself.generic_method("astype",dtype)
138138

139139
@property
140-
defshape(self)->"ArrayApi":
140+
defshape(self)->"BaseArrayApi":
141141
returnself.generic_method("shape")
142142

143-
defreshape(self,shape:"ArrayApi")->"ArrayApi":
143+
defreshape(self,shape:"BaseArrayApi")->"BaseArrayApi":
144144
returnself.generic_method("reshape",shape)
145145

146146
defsum(
147147
self,axis:OptParType[TupleType[int]]=None,keepdims:ParType[int]=0
148-
)->"ArrayApi":
148+
)->"BaseArrayApi":
149149
returnself.generic_method("sum",axis=axis,keepdims=keepdims)
150150

151151
defmean(
152152
self,axis:OptParType[TupleType[int]]=None,keepdims:ParType[int]=0
153-
)->"ArrayApi":
153+
)->"BaseArrayApi":
154154
returnself.generic_method("mean",axis=axis,keepdims=keepdims)
155155

156156
defmin(
157157
self,axis:OptParType[TupleType[int]]=None,keepdims:ParType[int]=0
158-
)->"ArrayApi":
158+
)->"BaseArrayApi":
159159
returnself.generic_method("min",axis=axis,keepdims=keepdims)
160160

161161
defmax(
162162
self,axis:OptParType[TupleType[int]]=None,keepdims:ParType[int]=0
163-
)->"ArrayApi":
163+
)->"BaseArrayApi":
164164
returnself.generic_method("max",axis=axis,keepdims=keepdims)
165165

166166
defprod(
167167
self,axis:OptParType[TupleType[int]]=None,keepdims:ParType[int]=0
168-
)->"ArrayApi":
168+
)->"BaseArrayApi":
169169
returnself.generic_method("prod",axis=axis,keepdims=keepdims)
170170

171-
defcopy(self)->"ArrayApi":
171+
defcopy(self)->"BaseArrayApi":
172172
returnself.generic_method("copy")
173173

174-
defflatten(self)->"ArrayApi":
174+
defflatten(self)->"BaseArrayApi":
175175
returnself.generic_method("flatten")
176176

177-
def__getitem__(self,index:Any)->"ArrayApi":
177+
def__getitem__(self,index:Any)->"BaseArrayApi":
178178
returnself.generic_method("__getitem__",index)
179179

180180
def__setitem__(self,index:Any,values:Any):

‎onnx_array_api/npx/npx_functions.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from .npx_constantsimportFUNCTION_DOMAIN
1010
from .npx_core_apiimportcst,make_tuple,npxapi_inline,npxapi_no_inline,var
11-
from .npx_tensorsimportArrayApi
11+
from .npx_tensorsimportBaseArrayApi
1212
from .npx_typesimport (
1313
DType,
1414
ElemType,
@@ -173,7 +173,7 @@ def asarray(
173173
raiseRuntimeError("Method 'astype' should be used to change the type.")
174174
iforderisnotNone:
175175
raiseNotImplementedError(f"order={order!r} not implemented.")
176-
ifisinstance(a,ArrayApi):
176+
ifisinstance(a,BaseArrayApi):
177177
ifcopy:
178178
returna.__class__(a,copy=copy)
179179
returna
@@ -404,7 +404,7 @@ def isdtype(
404404
dtype:DType,kind:Union[DType,str,Tuple[Union[DType,str], ...]]
405405
)->bool:
406406
"""
407-
See :epkg:`ArrayAPI:isdtype`.
407+
See :epkg:`BaseArrayAPI:isdtype`.
408408
This function is not converted into an onnx graph.
409409
"""
410410
returnnp_array_api.isdtype(dtype,kind)

‎onnx_array_api/npx/npx_tensors.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
importnumpyasnp
44
fromonnx.helperimportnp_dtype_to_tensor_dtype
55

6-
from .npx_array_apiimportArrayApi,ArrayApiError
6+
from .npx_array_apiimportBaseArrayApi,ArrayApiError
77

88

99
classJitTensor:
@@ -14,11 +14,11 @@ class JitTensor:
1414
pass
1515

1616

17-
classEagerTensor(ArrayApi):
17+
classEagerTensor(BaseArrayApi):
1818
"""
1919
Defines a value for a specific eager mode.
2020
An eager tensor must overwrite every call to a method listed in class
21-
:class:`ArrayApi`.
21+
:class:`BaseArrayApi`.
2222
"""
2323

2424
def__iter__(self):
@@ -215,7 +215,7 @@ def generic_method(self, method_name, *args: Any, **kwargs: Any) -> Any:
215215
returnself._generic_method_getitem(method_name,*args,**kwargs)
216216

217217
ifmethod_name=="__setitem__":
218-
returnArrayApi.generic_method(self,method_name,*args,**kwargs)
218+
returnBaseArrayApi.generic_method(self,method_name,*args,**kwargs)
219219

220220
ifmethod_namein {"mean","sum","min","max","prod"}:
221221
returnself._generic_method_reduce(method_name,*args,**kwargs)
@@ -226,4 +226,4 @@ def generic_method(self, method_name, *args: Any, **kwargs: Any) -> Any:
226226
ifmethod_name.startswith("__")andmethod_name.endswith("__"):
227227
returnself._generic_method_operator(method_name,*args,**kwargs)
228228

229-
returnArrayApi.generic_method(self,method_name,*args,**kwargs)
229+
returnBaseArrayApi.generic_method(self,method_name,*args,**kwargs)

‎onnx_array_api/npx/npx_var.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
fromonnximportFunctionProto,ModelProto,NodeProto,TensorProto
55
fromonnx.helperimportnp_dtype_to_tensor_dtype
66

7-
from .npx_array_apiimportArrayApi,ArrayApiError
7+
from .npx_array_apiimportBaseArrayApi,ArrayApiError
88
from .npx_constantsimportDEFAULT_OPSETS,ONNX_DOMAIN
99
from .npx_typesimportElemType,OptParType,ParType,TensorType,TupleType
1010

@@ -181,7 +181,7 @@ def to_onnx(
181181
returnonx
182182

183183

184-
classVar(ArrayApi):
184+
classVar(BaseArrayApi):
185185
"""
186186
Defines a variable, a result...
187187

‎onnx_array_api/ort/ort_tensors.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@ def get_ir_version(cls, ir_version):
231231

232232
classEagerOrtTensor(OrtTensor,OrtCommon,EagerTensor):
233233
"""
234-
Defines a value fora specific backend.
234+
Defines a value for:epkg:`onnxruntime` as a backend.
235235
"""
236236

237237
pass
238238

239239

240240
classJitOrtTensor(OrtTensor,OrtCommon,JitTensor):
241241
"""
242-
Defines a value fora specific backend.
242+
Defines a value for:epkg:`onnxruntime` as a backend.
243243
"""
244244

245245
pass

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp