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

[testing] Use tuples for numpy indexing #14476

Merged
merged 1 commit into from
Apr 4, 2023

Conversation

kparzysz-quic
Copy link
Contributor

Some versions of numpy disallow the following:

>>> import numpy as np
>>> a = np.zeros(10)
>>> b = [slice(None)]
>>> a[b]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices

When b is a tuple, it works fine:

>>> a[tuple(b)]
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])

Some versions of numpy disallow the following:

>>> import numpy as np
>>> a = np.zeros(10)
>>> b = [slice(None)]
>>> a[b]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis
(`None`) and integer or boolean arrays are valid indices

When b is a tuple, it works fine:

>>> a[tuple(b)]
array([0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
@tvm-bot
Copy link
Collaborator

tvm-bot commented Apr 3, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to tag found in teams: testing See #10317 for details

Generated by tvm-bot

@AndrewZhaoLuo AndrewZhaoLuo merged commit 4d7e890 into apache:main Apr 4, 2023
@kparzysz-quic kparzysz-quic deleted the numpy-tuples branch April 4, 2023 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants