Skip to content

Conversation

@ev-br
Copy link
Member

@ev-br ev-br commented Nov 22, 2025

fixes #360

A matching test update: data-apis/array-api-tests#397

@ev-br ev-br changed the title ENH: torch: allow negative indices in take_along_axis ENH: torch: allow negative indices in take and take_along_axis Nov 22, 2025
Copy link

@mdhaber mdhaber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matching test is exactly what I'd like to see. How can we see that torch passes the test with this change?

I'm kicking myself, but it looks like I didn't take note of where I experienced this, so I can't provide a test of where this came up in the wild, but the solution and tests LGTM.

@ev-br
Copy link
Member Author

ev-br commented Nov 23, 2025

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.

@mdhaber
Copy link

mdhaber commented Nov 23, 2025

Oh, OK. Well the test change looked good, so I'll see when it runs here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

torch take_along_axis does not support negative indices

2 participants