Skip to content

AttributeError: module 'array_api_compat.torch' has no attribute 'newaxis' #64

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

Closed
ogrisel opened this issue Oct 23, 2023 · 1 comment · Fixed by #66
Closed

AttributeError: module 'array_api_compat.torch' has no attribute 'newaxis' #64

ogrisel opened this issue Oct 23, 2023 · 1 comment · Fixed by #66

Comments

@ogrisel
Copy link

ogrisel commented Oct 23, 2023

According to:

the namespace modules should expose an alias to None named newaxis to make indexing code more explicit.

However it seems to be missing in array-api-compat, at least for PyTorch:

>>> import array_api_compat.torch as xp
>>> xp.newaxis is None
Traceback (most recent call last):
  Cell In[6], line 1
    xp.newaxis
AttributeError: module 'array_api_compat.torch' has no attribute 'newaxis'

Note, the same snippet works with numpy:

>>> import array_api_compat.numpy as xp
>>> xp.newaxis is None
True
@asmeurer
Copy link
Member

I guess newaxis isn't in the main torch namespace. I would have expected this to be caught by the test suite, but I guess not.

rgommers added a commit to rgommers/array-api-compat that referenced this issue Nov 9, 2023
rgommers added a commit to rgommers/array-api-compat that referenced this issue Nov 14, 2023
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 a pull request may close this issue.

2 participants