Skip to content

Commit e3fdc3b

Browse files
ev-brlezcano
andauthored
Update torch_np/_detail/_util.py
Fuse logical ops in normalize_axis_index Co-authored-by: Mario Lezcano Casado <[email protected]>
1 parent 214e0f1 commit e3fdc3b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

torch_np/_detail/_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class UFuncTypeError(TypeError, RuntimeError):
3535

3636
# a replica of the version in ./numpy/numpy/core/src/multiarray/common.h
3737
def normalize_axis_index(ax, ndim, argname=None):
38-
if ax < -ndim or ax >= ndim:
38+
if not (-ndim <= ax < ndim):
3939
raise AxisError(f"axis {ax} is out of bounds for array of dimension {ndim}")
4040
if ax < 0:
4141
ax += ndim

0 commit comments

Comments
 (0)