@@ -13,7 +13,7 @@ class ArrayApiError(RuntimeError):
13
13
pass
14
14
15
15
16
- class ArrayApi :
16
+ class BaseArrayApi :
17
17
"""
18
18
List of supported method by a tensor.
19
19
"""
@@ -36,145 +36,145 @@ def generic_method(self, method_name, *args: Any, **kwargs: Any) -> Any:
36
36
f"for class { self .__class__ .__name__ !r} . "
37
37
f"Method 'generic_method' can be overwritten "
38
38
f"as well to change the behaviour "
39
- f"for all methods supported by class ArrayApi ."
39
+ f"for all methods supported by class BaseArrayApi ."
40
40
)
41
41
42
42
def numpy (self ) -> np .ndarray :
43
43
return self .generic_method ("numpy" )
44
44
45
- def __neg__ (self ) -> "ArrayApi " :
45
+ def __neg__ (self ) -> "BaseArrayApi " :
46
46
return self .generic_method ("__neg__" )
47
47
48
- def __invert__ (self ) -> "ArrayApi " :
48
+ def __invert__ (self ) -> "BaseArrayApi " :
49
49
return self .generic_method ("__invert__" )
50
50
51
- def __add__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
51
+ def __add__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
52
52
return self .generic_method ("__add__" , ov )
53
53
54
- def __radd__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
54
+ def __radd__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
55
55
return self .generic_method ("__radd__" , ov )
56
56
57
- def __sub__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
57
+ def __sub__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
58
58
return self .generic_method ("__sub__" , ov )
59
59
60
- def __rsub__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
60
+ def __rsub__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
61
61
return self .generic_method ("__rsub__" , ov )
62
62
63
- def __mul__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
63
+ def __mul__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
64
64
return self .generic_method ("__mul__" , ov )
65
65
66
- def __rmul__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
66
+ def __rmul__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
67
67
return self .generic_method ("__rmul__" , ov )
68
68
69
- def __matmul__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
69
+ def __matmul__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
70
70
return self .generic_method ("__matmul__" , ov )
71
71
72
- def __truediv__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
72
+ def __truediv__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
73
73
return self .generic_method ("__truediv__" , ov )
74
74
75
- def __rtruediv__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
75
+ def __rtruediv__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
76
76
return self .generic_method ("__rtruediv__" , ov )
77
77
78
- def __mod__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
78
+ def __mod__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
79
79
return self .generic_method ("__mod__" , ov )
80
80
81
- def __rmod__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
81
+ def __rmod__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
82
82
return self .generic_method ("__rmod__" , ov )
83
83
84
- def __pow__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
84
+ def __pow__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
85
85
return self .generic_method ("__pow__" , ov )
86
86
87
- def __rpow__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
87
+ def __rpow__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
88
88
return self .generic_method ("__rpow__" , ov )
89
89
90
- def __lt__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
90
+ def __lt__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
91
91
return self .generic_method ("__lt__" , ov )
92
92
93
- def __le__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
93
+ def __le__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
94
94
return self .generic_method ("__le__" , ov )
95
95
96
- def __gt__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
96
+ def __gt__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
97
97
return self .generic_method ("__gt__" , ov )
98
98
99
- def __ge__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
99
+ def __ge__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
100
100
return self .generic_method ("__ge__" , ov )
101
101
102
- def __eq__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
102
+ def __eq__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
103
103
return self .generic_method ("__eq__" , ov )
104
104
105
- def __ne__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
105
+ def __ne__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
106
106
return self .generic_method ("__ne__" , ov )
107
107
108
- def __lshift__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
108
+ def __lshift__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
109
109
return self .generic_method ("__lshift__" , ov )
110
110
111
- def __rshift__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
111
+ def __rshift__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
112
112
return self .generic_method ("__rshift__" , ov )
113
113
114
- def __and__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
114
+ def __and__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
115
115
return self .generic_method ("__and__" , ov )
116
116
117
- def __rand__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
117
+ def __rand__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
118
118
return self .generic_method ("__rand__" , ov )
119
119
120
- def __or__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
120
+ def __or__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
121
121
return self .generic_method ("__or__" , ov )
122
122
123
- def __ror__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
123
+ def __ror__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
124
124
return self .generic_method ("__ror__" , ov )
125
125
126
- def __xor__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
126
+ def __xor__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
127
127
return self .generic_method ("__xor__" , ov )
128
128
129
- def __rxor__ (self , ov : "ArrayApi " ) -> "ArrayApi " :
129
+ def __rxor__ (self , ov : "BaseArrayApi " ) -> "BaseArrayApi " :
130
130
return self .generic_method ("__rxor__" , ov )
131
131
132
132
@property
133
- def T (self ) -> "ArrayApi " :
133
+ def T (self ) -> "BaseArrayApi " :
134
134
return self .generic_method ("T" )
135
135
136
- def astype (self , dtype : Any ) -> "ArrayApi " :
136
+ def astype (self , dtype : Any ) -> "BaseArrayApi " :
137
137
return self .generic_method ("astype" , dtype )
138
138
139
139
@property
140
- def shape (self ) -> "ArrayApi " :
140
+ def shape (self ) -> "BaseArrayApi " :
141
141
return self .generic_method ("shape" )
142
142
143
- def reshape (self , shape : "ArrayApi " ) -> "ArrayApi " :
143
+ def reshape (self , shape : "BaseArrayApi " ) -> "BaseArrayApi " :
144
144
return self .generic_method ("reshape" , shape )
145
145
146
146
def sum (
147
147
self , axis : OptParType [TupleType [int ]] = None , keepdims : ParType [int ] = 0
148
- ) -> "ArrayApi " :
148
+ ) -> "BaseArrayApi " :
149
149
return self .generic_method ("sum" , axis = axis , keepdims = keepdims )
150
150
151
151
def mean (
152
152
self , axis : OptParType [TupleType [int ]] = None , keepdims : ParType [int ] = 0
153
- ) -> "ArrayApi " :
153
+ ) -> "BaseArrayApi " :
154
154
return self .generic_method ("mean" , axis = axis , keepdims = keepdims )
155
155
156
156
def min (
157
157
self , axis : OptParType [TupleType [int ]] = None , keepdims : ParType [int ] = 0
158
- ) -> "ArrayApi " :
158
+ ) -> "BaseArrayApi " :
159
159
return self .generic_method ("min" , axis = axis , keepdims = keepdims )
160
160
161
161
def max (
162
162
self , axis : OptParType [TupleType [int ]] = None , keepdims : ParType [int ] = 0
163
- ) -> "ArrayApi " :
163
+ ) -> "BaseArrayApi " :
164
164
return self .generic_method ("max" , axis = axis , keepdims = keepdims )
165
165
166
166
def prod (
167
167
self , axis : OptParType [TupleType [int ]] = None , keepdims : ParType [int ] = 0
168
- ) -> "ArrayApi " :
168
+ ) -> "BaseArrayApi " :
169
169
return self .generic_method ("prod" , axis = axis , keepdims = keepdims )
170
170
171
- def copy (self ) -> "ArrayApi " :
171
+ def copy (self ) -> "BaseArrayApi " :
172
172
return self .generic_method ("copy" )
173
173
174
- def flatten (self ) -> "ArrayApi " :
174
+ def flatten (self ) -> "BaseArrayApi " :
175
175
return self .generic_method ("flatten" )
176
176
177
- def __getitem__ (self , index : Any ) -> "ArrayApi " :
177
+ def __getitem__ (self , index : Any ) -> "BaseArrayApi " :
178
178
return self .generic_method ("__getitem__" , index )
179
179
180
180
def __setitem__ (self , index : Any , values : Any ):
0 commit comments