Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CuPy and NumPy raise different exceptions for indexing with multiple ellipsis #5714

Closed
leofang opened this issue Sep 8, 2021 · 1 comment · Fixed by #5718
Closed

CuPy and NumPy raise different exceptions for indexing with multiple ellipsis #5714

leofang opened this issue Sep 8, 2021 · 1 comment · Fixed by #5718
Assignees

Comments

@leofang
Copy link
Member

leofang commented Sep 8, 2021

CuPy raises ValueError while NumPy raises IndexError:

>>> import cupy as cp
>>> a = cp.random.random((3, 3,3))
>>> a[..., ..., 1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cupy/_core/core.pyx", line 1380, in cupy._core.core.ndarray.__getitem__
    return _indexing._ndarray_getitem(self, slices)
  File "cupy/_core/_routines_indexing.pyx", line 36, in cupy._core._routines_indexing._ndarray_getitem
    slice_list, advanced, mask_exists = _prepare_slice_list(
  File "cupy/_core/_routines_indexing.pyx", line 249, in cupy._core._routines_indexing._prepare_slice_list
    slice_list, n_newaxes = internal.complete_slice_list(slice_list, ndim)
  File "cupy/_core/internal.pyx", line 251, in cupy._core.internal.complete_slice_list
    raise ValueError('Only one Ellipsis is allowed in index')
ValueError: Only one Ellipsis is allowed in index
>>> 
>>> import numpy as np
>>> a = np.random.random((3, 3, 3))
>>> a[..., ..., 1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: an index can only have a single ellipsis ('...')
@leofang
Copy link
Member Author

leofang commented Sep 8, 2021

Note: this relates to the test_indexing.py failure seen in #5698 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants