FYI/Clarification for `*_like(arr)` functions using `arr.device`
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by reviewing the Array API requirement for *_like(arr) device handling and the reported CuPy, JAX, and torch behavior in the issue. Done means maintainers decide whether the standard needs clarification or a behavior change, with the expected compatibility impact documented.
Written by the indexing model from the issue text.
Description
This may be more of a CuPy question about how comfortable CuPy is with changing behavior and pushing through the change in v15. But it does come from the Array API so just bringing it up here once for awareness.
The standard states that empty_like(arr) should allocate as if empty_like(arr, device=arr.device) was passed. And that is actually what JAX and torch do:
import cupy as cp
arr = cp.arange(1000) # arr.device == Device(0)
with cp.cuda.Device(1)
print(cp.empty_like(arr).device) # Device(1) for cupy, 0 for JAX/torch
CuPy does currently not do this (I half suspect this was missed at the time), CuPy completely relies on context managers right now (to the point that even a NumPy array works there).
CC @leofang
- Dominant language
- Python
- Stars
- 281
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api
-
bug Maintenance Narrative Content
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Maintenance
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 3/5 1-2 days Newbie friendliness 50/100
All issues in data-apis/array-api
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·