@@ -176,56 +176,35 @@ def stack(arrays, axis=0, out=None, *, dtype=None, casting="same_kind"):
176
176
def array_split (ary , indices_or_sections , axis = 0 ):
177
177
tensor = asarray (ary ).get ()
178
178
base = ary if isinstance (ary , ndarray ) else None
179
- axis = _util .normalize_axis_index (axis , tensor .ndim )
180
-
181
179
result = _impl .split_helper (tensor , indices_or_sections , axis )
182
-
183
180
return tuple (maybe_set_base (x , base ) for x in result )
184
181
185
182
186
183
def split (ary , indices_or_sections , axis = 0 ):
187
184
tensor = asarray (ary ).get ()
188
185
base = ary if isinstance (ary , ndarray ) else None
189
- axis = _util .normalize_axis_index (axis , tensor .ndim )
190
-
191
186
result = _impl .split_helper (tensor , indices_or_sections , axis , strict = True )
192
-
193
187
return tuple (maybe_set_base (x , base ) for x in result )
194
188
195
189
196
190
def hsplit (ary , indices_or_sections ):
197
191
tensor = asarray (ary ).get ()
198
192
base = ary if isinstance (ary , ndarray ) else None
199
-
200
- if tensor .ndim == 0 :
201
- raise ValueError ("hsplit only works on arrays of 1 or more dimensions" )
202
-
203
- axis = 1 if tensor .ndim > 1 else 0
204
-
205
- result = _impl .split_helper (tensor , indices_or_sections , axis , strict = True )
206
-
193
+ result = _impl .hsplit (tensor , indices_or_sections )
207
194
return tuple (maybe_set_base (x , base ) for x in result )
208
195
209
196
210
197
def vsplit (ary , indices_or_sections ):
211
198
tensor = asarray (ary ).get ()
212
199
base = ary if isinstance (ary , ndarray ) else None
213
-
214
- if tensor .ndim < 2 :
215
- raise ValueError ("vsplit only works on arrays of 2 or more dimensions" )
216
- result = _impl .split_helper (tensor , indices_or_sections , 0 , strict = True )
217
-
200
+ result = _impl .vsplit (tensor , indices_or_sections )
218
201
return tuple (maybe_set_base (x , base ) for x in result )
219
202
220
203
221
204
def dsplit (ary , indices_or_sections ):
222
205
tensor = asarray (ary ).get ()
223
206
base = ary if isinstance (ary , ndarray ) else None
224
-
225
- if tensor .ndim < 3 :
226
- raise ValueError ("dsplit only works on arrays of 3 or more dimensions" )
227
- result = _impl .split_helper (tensor , indices_or_sections , 2 , strict = True )
228
-
207
+ result = _impl .dsplit (tensor , indices_or_sections )
229
208
return tuple (maybe_set_base (x , base ) for x in result )
230
209
231
210
0 commit comments