Repository navigation
Preserve vectorized block outputs in EXLA and gradients - #1842
Merged
Merged
Conversation
This was referenced Sep 26, 2026
polvalente
approved these changes
Sep 26, 2026
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.
Vectorized tensors returned by an
Nx.blockcallback can produce an EXLA function signature that omits their vectorized dimensions. Gradient traversal also needs the callback result expressed with those dimensions included.Devectorize callback results when constructing the EXLA block implementation and when traversing the block expression for gradients. Container results are traversed so tuple outputs retain the same treatment.
Regression tests cover mixed vectorized axes, tuple outputs containing numeric and boolean tensors, and gradients through a nonlinear composition. The Nx definition/gradient suite passed 531 tests on both macOS ARM64 and Linux x86_64. The combined EXLA expression/Axon activation suite passed 421 tests per host; 48 evaluator-only doctests were excluded from that EXLA run. Validation used the companion erfc-based Axon GELU change (elixir-nx/axon#681).