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

torch.zeros can not pass shape as keyword argument #22

Closed
thomasjpfan opened this issue Mar 3, 2023 · 2 comments
Closed

torch.zeros can not pass shape as keyword argument #22

thomasjpfan opened this issue Mar 3, 2023 · 2 comments

Comments

@thomasjpfan
Copy link
Contributor

import array_api_compat
import torch

x = torch.asarray([1.0, 2.0, 3.0])
xp = array_api_compat.get_namespace(x)
xp.zeros(shape=(8, 4))
# TypeError: zeros() missing 1 required positional arguments: "size"
@rgommers
Copy link
Member

rgommers commented Mar 4, 2023

Indeed, shape isn't positional-only so that will need some mapping from shape to size.

@asmeurer
Copy link
Member

asmeurer commented Mar 6, 2023

This is something I would have expected the test suite to catch. @honno

Either way, the fix here is easy. We just need to add a wrapper for zeros using the spec signature.

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

No branches or pull requests

3 participants