Open
Description
The array API standard seems to support negative step.
The basic slice syntax is
i:j:k
wherei
is the starting index,j
is the stopping index, andk
is the step (k != 0
).
But array-api-compat.torch
tensors do not:
from array_api_compat import torch
x = torch.arange(10)
x[::-1] # ValueError: step must be greater than zero
Adding support for negative step
would be appreciated! (In the meantime, I can use flip
.) Thanks for considering it.