ENH: torch: allow negative indices in `take` and `take_along_axis`
fixes https://github.com/data-apis/array-api-compat/issues/360
A matching test update: https://github.com/data-apis/array-api-tests/pull/397
How can we see that torch passes the test with this change
Locally one incantation is (run from the source tree of the array_api_tests clone):
ARRAY_API_TESTS_SKIP_DTYPES=uint16,uint32,uint64 ARRAY_API_TESTS_MODULE=array_api_compat.torch pytest array_api_tests/test_indexing_functions.py::test_take_along_axis -v --max-examples=10_000 -s
On CI, we'll need to land the array-api-tests fix first, and rerun the CI here to pick up the updated master branch of array-api-tests.
Oh, OK. Well the test change looked good, so I'll see when it runs here.
Now that https://github.com/pytorch/pytorch/issues/146211 is fixed in pytorch, we'll be able to undo the workaround of this PR for take_along_axis--- when the minimum supported torch version includes the fix.
What is the support window for torch and other backends is not very well defined though, this probably something to discuss at a consortium meeting.
Also, we still need the workaround for take: need Tensor.index_select to support negative indices, which it does not.
https://github.com/data-apis/array-api-tests/pull/397#issuecomment-3602935540 : tests aiming to probe this pass locally, let's see if CI agrees.
EDIT: and it does. Merging.