Skip to content

Preserve vectorized block outputs in EXLA and gradients - #1842

Merged
polvalente merged 1 commit into
elixir-nx:mainfrom
hfiguera:exla-vectorized-blocks
Sep 27, 2026
Merged

polvalente merged 1 commit into
elixir-nx:mainfrom
hfiguera:exla-vectorized-blocks

Conversation

@hfiguera

@hfiguera hfiguera commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Vectorized tensors returned by an Nx.block callback 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).

@polvalente
polvalente merged commit a007602 into elixir-nx:main Sep 27, 2026
9 checks passed
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.

2 participants