[Pallas] Switch gather to jnp.take_along_axis (for JAX issue filing)#2061
Draft
AmesingFlank wants to merge 1 commit into
Draft
[Pallas] Switch gather to jnp.take_along_axis (for JAX issue filing)#2061AmesingFlank wants to merge 1 commit into
AmesingFlank wants to merge 1 commit into
Conversation
AmesingFlank
added a commit
that referenced
this pull request
Apr 20, 2026
This version uses jnp.take_along_axis which is the natural JAX equivalent of torch.gather. It works in interpret mode but fails on real TPU due to a limitation in Mosaic's lax.gather lowering rule which requires indices.shape == input.shape + (1,). Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> stack-info: PR: #2061, branch: AmesingFlank/stack/27
1a3b7f5 to
696b52e
Compare
3a1edd6 to
15cbc51
Compare
This was referenced Apr 20, 2026
AmesingFlank
added a commit
that referenced
this pull request
Apr 20, 2026
This version uses jnp.take_along_axis which is the natural JAX equivalent of torch.gather. It works in interpret mode but fails on real TPU due to a limitation in Mosaic's lax.gather lowering rule which requires indices.shape == input.shape + (1,). Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> stack-info: PR: #2061, branch: AmesingFlank/stack/27
AmesingFlank
added a commit
that referenced
this pull request
Apr 20, 2026
This version uses jnp.take_along_axis which is the natural JAX equivalent of torch.gather. It works in interpret mode but fails on real TPU due to a limitation in Mosaic's lax.gather lowering rule which requires indices.shape == input.shape + (1,). Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> stack-info: PR: #2061, branch: AmesingFlank/stack/27
This version uses jnp.take_along_axis which is the natural JAX equivalent of torch.gather. It works in interpret mode but fails on real TPU due to a limitation in Mosaic's lax.gather lowering rule which requires indices.shape == input.shape + (1,). Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com> stack-info: PR: #2061, branch: AmesingFlank/stack/27
15cbc51 to
b1ca465
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked PRs:
[Pallas] Switch gather to jnp.take_along_axis (for JAX issue filing)
This version uses jnp.take_along_axis which is the natural JAX equivalent
of torch.gather. It works in interpret mode but fails on real TPU due to
a limitation in Mosaic's lax.gather lowering rule which requires
indices.shape == input.shape + (1,).
Co-Authored-By: Claude Sonnet 4 noreply@anthropic.com