Skip to content

Commit 208c4a1

Browse files
committed
MAINT: simplify axis_out_keepdims decorator
1 parent 1f80805 commit 208c4a1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

torch_np/_ndarray.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@ def wrapped(a, axis=None, out=None, keepdims=NoValue, *args, **kwds):
2222
arr = asarray(a)
2323
axis = _helpers.standardize_axis_arg(axis, arr.ndim)
2424

25-
arr1 = arr
2625
if axis == ():
2726
newshape = _util.expand_shape(arr.shape, axis=0)
28-
arr1 = arr.reshape(newshape)
27+
arr = arr.reshape(newshape)
2928
axis = (0,)
3029

31-
result = func(arr1, axis=axis, *args, **kwds)
30+
result = func(arr, axis=axis, *args, **kwds)
3231

3332
if keepdims:
34-
result = _helpers.apply_keepdims(result, axis, arr1.ndim)
33+
result = _helpers.apply_keepdims(result, axis, arr.ndim)
3534
return _helpers.result_or_out(result, out)
3635

3736
return wrapped

0 commit comments

Comments
 (0)