Skip to content

torch.count_nonzero fails with axis tuple and keepdims=True #311

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

Open
mdhaber opened this issue Apr 18, 2025 · 0 comments · May be fixed by #318
Open

torch.count_nonzero fails with axis tuple and keepdims=True #311

mdhaber opened this issue Apr 18, 2025 · 0 comments · May be fixed by #318
Milestone

Comments

@mdhaber
Copy link

mdhaber commented Apr 18, 2025

from array_api_compat import torch as xp
x = xp.asarray([1])
xp.count_nonzero(x, axis=(0,), keepdims=True)
# TypeError: unsqueeze(): argument 'dim' (position 1) must be int, not tuple
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