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

2023.12 compat: astype has no device kwarg #226

Closed
lucascolley opened this issue Jan 4, 2025 · 2 comments · Fixed by #240
Closed

2023.12 compat: astype has no device kwarg #226

lucascolley opened this issue Jan 4, 2025 · 2 comments · Fixed by #240

Comments

@lucascolley
Copy link
Member

I don't have a need for using the device kwarg yet, but it would be useful for it to at least exist!

@lithomas1
Copy link
Contributor

Looks like this should be an issue for all the wrapped libaries since it's missing from the common wrapper

def astype(x: ndarray, dtype: Dtype, /, *, copy: bool = True) -> ndarray:
if not copy and dtype == x.dtype:
return x
return x.astype(dtype=dtype, copy=copy)

@mdhaber
Copy link

mdhaber commented Jan 22, 2025

Just ran into this.

import numpy as np
np.astype(np.asarray(True), np.bool, device=None)

from array_api_compat import numpy as np
np.astype(np.asarray(True), np.bool, device=None)
# TypeError: astype() got an unexpected keyword argument 'device'

@lucascolley lucascolley changed the title 2023.12 compat: torch.astype has no device kwarg 2023.12 compat:astype has no device kwarg Jan 22, 2025
@lucascolley lucascolley changed the title 2023.12 compat:astype has no device kwarg 2023.12 compat: astype has no device kwarg Jan 22, 2025
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.

3 participants