-
Notifications
You must be signed in to change notification settings - Fork 29
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
Automatically use the correct device in xp.clip with passed Python number literal as bounds #177
Comments
Note that I have not investigated if other array API namespaces suffer from the same problem. |
Ah, I completely forgot about devices when I wrote this wrapper. |
BTW, is this something that should be made explicit in the spec itself? Or would that just make the spec unnecessarily verbose? Maybe it could just be tested in |
I think it's covered by the general design principles, e.g., https://data-apis.org/array-api/latest/design_topics/device_support.html, "This standard chooses to add support for method 3 (local control), with the convention that execution takes place on the same device where all argument arrays are allocated" We could add a bullet point to that bullet point list that Python scalars and other such non-array-library objects should not influence device assignment. And +1 for a test. |
Yes, unfortunately, device support is not tested at all in the test suite right now. |
Note that the a = xp.linspace(-1, 1, 10, dtype=xp.float32)
assert xp.clip(a, 0, 1).dtype == xp.float32 EDIT: it seems that dtype handling is part of #166. |
The |
I would like the following not to fail with PyTorch:
At the moment, we need to be overly verbose to use
xp.clip
with pytorch on non-cpu tensors:The text was updated successfully, but these errors were encountered: