Fix to raise numpy.AxisError
@@ -27,7 +27,7 @@ cdef _ndarray_sort(ndarray self, int axis):
'reinstall CuPy after uninstalling it.')
if ndim == 0:
- raise ValueError('Sorting arrays with the rank of zero is not '
+ raise numpy.AxisError('Sorting arrays with the rank of zero is not '
'supported') # as numpy.sort() raises
# TODO(takagi): Support sorting views
@@ -69,8 +69,7 @@ cdef ndarray _ndarray_argsort(ndarray self, axis):
'reinstall CuPy after uninstalling it.')
if ndim == 0:
- raise ValueError('Sorting arrays with the rank of zero is not '
- 'supported') # as numpy.argsort() raises
+ return cupy.zeros((1,), dtype=cupy.int64)
if axis is None:
data = self.ravel()
@@ -132,7 +131,7 @@ cdef _ndarray_partition(ndarray self, kth, int axis):
cdef ndarray data
if ndim == 0:
- raise ValueError('Sorting arrays with the rank of zero is not '
+ raise numpy.AxisError('Sorting arrays with the rank of zero is not '
'supported')
if not self._c_contiguous:
