Skip to content

torch take_along_axis does not support negative indices #360

Description

@mdhaber

The standard states that take_along_axis must support negative indices as usual, but:

from array_api_compat import torch as xp
xp.take_along_axis(xp.asarray([1]), xp.asarray([-1]))
# RuntimeError: index -1 is out of bounds for dimension 0 with size 1

Activity

  1. ev-br commented on Nov 22, 2025

    @ev-br
    Member

    cf #361 for a fix and data-apis/array-api-tests#397 for a test.

    Would be helpful if you could test-drive gh-361 @mdhaber

  2. added this to the 1.13 milestone on Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions