Removed usage of numpy's normalize_axis_index
import numpy
-from numpy.polynomial import chebyshev
import six
import cupy
@@ -8,6 +7,7 @@ from cupy import internal
from cupy.linalg.solve import inv
from cupy.util import collections_abc
+from cupy.math.misc import normalize_axis_index
matmul = core.matmul
@@ -105,12 +105,8 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None):
a = cupy.asarray(a)
b = cupy.asarray(b)
# Check axisa and axisb are within bounds
- # TODO(UmashankarTriforce): Implement normalize_axis_index in cupy
-
- axisa = chebyshev.normalize_axis_index(
- axisa, a.ndim, msg_prefix='axisa')
- axisb = chebyshev.normalize_axis_index(
- axisb, b.ndim, msg_prefix='axisb')
+ axisa = normalize_axis_index(axisa, a.ndim)
+ axisb = normalize_axis_index(axisb, b.ndim)
# Move working axis to the end of the shape
a = cupy.moveaxis(a, axisa, -1)
@@ -125,8 +121,7 @@ def cross(a, b, axisa=-1, axisb=-1, axisc=-1, axis=None):
if a.shape[-1] == 3 or b.shape[-1] == 3:
shape += (3,)
# Check axisc is within bounds
- axisc = chebyshev.normalize_axis_index(
- axisc, len(shape), msg_prefix='axisc')
+ axisc = normalize_axis_index(axisc, len(shape))
dtype = cupy.promote_types(a.dtype, b.dtype)
cp = cupy.empty(shape, dtype)
