20
20
@normalizer
21
21
def nonzero (a : ArrayLike ):
22
22
result = a .nonzero (as_tuple = True )
23
- return _helpers . tuple_arrays_from ( result )
23
+ return result
24
24
25
25
26
26
@normalizer
27
27
def argwhere (a : ArrayLike ):
28
28
result = torch .argwhere (a )
29
- return _helpers . array_from ( result )
29
+ return result
30
30
31
31
32
32
@normalizer
33
33
def flatnonzero (a : ArrayLike ):
34
34
result = a .ravel ().nonzero (as_tuple = True )[0 ]
35
- return _helpers . array_from ( result )
35
+ return result
36
36
37
37
38
38
@normalizer
@@ -52,13 +52,13 @@ def clip(
52
52
def repeat (a : ArrayLike , repeats : ArrayLike , axis = None ):
53
53
# XXX: scalar repeats; ArrayLikeOrScalar ?
54
54
result = torch .repeat_interleave (a , repeats , axis )
55
- return _helpers . array_from ( result )
55
+ return result
56
56
57
57
58
58
@normalizer
59
59
def tile (A : ArrayLike , reps ):
60
60
result = _impl .tile (A , reps )
61
- return _helpers . array_from ( result )
61
+ return result
62
62
63
63
64
64
# ### diag et al ###
@@ -67,7 +67,7 @@ def tile(A: ArrayLike, reps):
67
67
@normalizer
68
68
def diagonal (a : ArrayLike , offset = 0 , axis1 = 0 , axis2 = 1 ):
69
69
result = _impl .diagonal (a , offset , axis1 , axis2 )
70
- return _helpers . array_from ( result )
70
+ return result
71
71
72
72
73
73
@normalizer
@@ -88,42 +88,42 @@ def eye(N, M=None, k=0, dtype: DTypeLike = float, order="C", *, like: SubokLike
88
88
if order != "C" :
89
89
raise NotImplementedError
90
90
result = _impl .eye (N , M , k , dtype )
91
- return _helpers . array_from ( result )
91
+ return result
92
92
93
93
94
94
@normalizer
95
95
def identity (n , dtype : DTypeLike = None , * , like : SubokLike = None ):
96
96
result = torch .eye (n , dtype = dtype )
97
- return _helpers . array_from ( result )
97
+ return result
98
98
99
99
100
100
@normalizer
101
101
def diag (v : ArrayLike , k = 0 ):
102
102
result = torch .diag (v , k )
103
- return _helpers . array_from ( result )
103
+ return result
104
104
105
105
106
106
@normalizer
107
107
def diagflat (v : ArrayLike , k = 0 ):
108
108
result = torch .diagflat (v , k )
109
- return _helpers . array_from ( result )
109
+ return result
110
110
111
111
112
112
def diag_indices (n , ndim = 2 ):
113
113
result = _impl .diag_indices (n , ndim )
114
- return _helpers . tuple_arrays_from ( result )
114
+ return result
115
115
116
116
117
117
@normalizer
118
118
def diag_indices_from (arr : ArrayLike ):
119
119
result = _impl .diag_indices_from (arr )
120
- return _helpers . tuple_arrays_from ( result )
120
+ return result
121
121
122
122
123
123
@normalizer
124
124
def fill_diagonal (a : ArrayLike , val : ArrayLike , wrap = False ):
125
125
result = _impl .fill_diagonal (a , val , wrap )
126
- return _helpers . array_from ( result )
126
+ return result
127
127
128
128
129
129
@normalizer
@@ -144,21 +144,21 @@ def dot(a: ArrayLike, b: ArrayLike, out: Optional[NDArray] = None):
144
144
@normalizer
145
145
def sort (a : ArrayLike , axis = - 1 , kind = None , order = None ):
146
146
result = _impl .sort (a , axis , kind , order )
147
- return _helpers . array_from ( result )
147
+ return result
148
148
149
149
150
150
@normalizer
151
151
def argsort (a : ArrayLike , axis = - 1 , kind = None , order = None ):
152
152
result = _impl .argsort (a , axis , kind , order )
153
- return _helpers . array_from ( result )
153
+ return result
154
154
155
155
156
156
@normalizer
157
157
def searchsorted (
158
158
a : ArrayLike , v : ArrayLike , side = "left" , sorter : Optional [ArrayLike ] = None
159
159
):
160
160
result = torch .searchsorted (a , v , side = side , sorter = sorter )
161
- return _helpers . array_from ( result )
161
+ return result
162
162
163
163
164
164
# ### swap/move/roll axis ###
@@ -167,19 +167,19 @@ def searchsorted(
167
167
@normalizer
168
168
def moveaxis (a : ArrayLike , source , destination ):
169
169
result = _impl .moveaxis (a , source , destination )
170
- return _helpers . array_from ( result )
170
+ return result
171
171
172
172
173
173
@normalizer
174
174
def swapaxes (a : ArrayLike , axis1 , axis2 ):
175
175
result = _impl .swapaxes (a , axis1 , axis2 )
176
- return _helpers . array_from ( result )
176
+ return result
177
177
178
178
179
179
@normalizer
180
180
def rollaxis (a : ArrayLike , axis , start = 0 ):
181
181
result = _impl .rollaxis (a , axis , start )
182
- return _helpers . array_from ( result )
182
+ return result
183
183
184
184
185
185
# ### shape manipulations ###
@@ -188,32 +188,32 @@ def rollaxis(a: ArrayLike, axis, start=0):
188
188
@normalizer
189
189
def squeeze (a : ArrayLike , axis = None ):
190
190
result = _impl .squeeze (a , axis )
191
- return _helpers . array_from ( result , a )
191
+ return result
192
192
193
193
194
194
@normalizer
195
195
def reshape (a : ArrayLike , newshape , order = "C" ):
196
196
result = _impl .reshape (a , newshape , order = order )
197
- return _helpers . array_from ( result , a )
197
+ return result
198
198
199
199
200
200
@normalizer
201
201
def transpose (a : ArrayLike , axes = None ):
202
202
result = _impl .transpose (a , axes )
203
- return _helpers . array_from ( result , a )
203
+ return result
204
204
205
205
206
206
@normalizer
207
207
def ravel (a : ArrayLike , order = "C" ):
208
208
result = _impl .ravel (a )
209
- return _helpers . array_from ( result , a )
209
+ return result
210
210
211
211
212
212
# leading underscore since arr.flatten exists but np.flatten does not
213
213
@normalizer
214
214
def _flatten (a : ArrayLike , order = "C" ):
215
215
result = _impl ._flatten (a )
216
- return _helpers . array_from ( result , a )
216
+ return result
217
217
218
218
219
219
# ### Type/shape etc queries ###
@@ -222,13 +222,13 @@ def _flatten(a: ArrayLike, order="C"):
222
222
@normalizer
223
223
def real (a : ArrayLike ):
224
224
result = torch .real (a )
225
- return _helpers . array_from ( result )
225
+ return result
226
226
227
227
228
228
@normalizer
229
229
def imag (a : ArrayLike ):
230
230
result = _impl .imag (a )
231
- return _helpers . array_from ( result )
231
+ return result
232
232
233
233
234
234
@normalizer
@@ -420,7 +420,7 @@ def any(
420
420
@normalizer
421
421
def count_nonzero (a : ArrayLike , axis : AxisLike = None , * , keepdims = False ):
422
422
result = _impl .count_nonzero (a , axis = axis , keepdims = keepdims )
423
- return _helpers . array_from ( result )
423
+ return result
424
424
425
425
426
426
@normalizer
0 commit comments