`array_api_compat.torch.take` with 0-d `indices`?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start at the array_api_compat.torch.take entry point and compare its 0-d indices behavior with torch.take and the Array API take specification, including data-apis/array-api#1010. Done means the behavior is resolved and consistent with the chosen interpretation.
Written by the indexing model from the issue text.
Description
array_api_compat.torch.take with 0-d indices produces a result with the same number of dimensions as the input.
from array_api_compat import torch as xp
x = xp.asarray([1])
xp.take(x, xp.asarray(0))
# tensor([1])
For non-wrapped torch.take (and all other array libraries) the output has one fewer dimension than the input.
import torch
x = torch.tensor([1])
torch.take(x, torch.asarray(0))
tensor(1)
from array_api_compat import numpy as xp
x = xp.asarray([1])
xp.take(x, xp.asarray(0))
# np.int64(1)
Technically, the standard of take requires indices to have exactly one dimension.
However, it also says:
Conceptually,
take(x, indices, axis=3)is equivalent tox[:,:,:,indices,...];...
This is up for discussion in data-apis/array-api#1010.
But I'd think that either all libraries should follow the letter of the standard as closely as possible in this situation ("The output array must have the same rank (i.e., number of dimensions) as x") or array_api_compat.torch.take should be consistent with torch.take.
- Dominant language
- Python
- Stars
- 131
- Forks
- 49
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 6
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-compat
-
blocked by upstream
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
data-apis/array-api-compat#439 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
data-apis/array-api-compat#395 · 2 comments ·
-
Release 1.16 Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
data-apis/array-api-compat#476 ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
data-apis/array-api-compat#473 · 4 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
data-apis/array-api-compat#465 · 3 comments ·
All issues in data-apis/array-api-compat
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 ·