You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
array_api_compat.torch.take with 0-d indices? #460
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.
the 0D behavior just falls out of the current workaround.
The 0D behavior is indeed not mandated by the spec, so what compat layer does is an extension to both torch and the spec behaviors.
A possible argument could be consistency with other major libraries in how they extend the spec: data-apis/array-api#1010
Activity
ev-br commentedon Aug 6, 2026
The dreaded spec mandates behavior more general than what torch implements strikes back again:
axisargument and negative indices;torch.takedoes support either of these;The 0D behavior is indeed not mandated by the spec, so what compat layer does is an extension to both torch and the spec behaviors.
A possible argument could be consistency with other major libraries in how they extend the spec:
data-apis/array-api#1010