Skip to content

Pass through non-Expr tensors in stop_grad/custom_grad/metadata - #1801

Closed
Chapaman wants to merge 2 commits into
elixir-nx:mainfrom
Chapaman:pv-guard-custom-grad-stop-grad-non-expr
Closed

Pass through non-Expr tensors in stop_grad/custom_grad/metadata#1801
Chapaman wants to merge 2 commits into
elixir-nx:mainfrom
Chapaman:pv-guard-custom-grad-stop-grad-non-expr

Conversation

@Chapaman

@Chapaman Chapaman commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Ties to Axon elixir-nx/axon#639
Real results were getting tagged as traced tensors when BinaryBackend.block/4 re-ran callbacks that used custom_grad/stop_grad/metadata
This PR makes Expr.metadata pass through non-Expr tensors so those callbacks stay safe on forward.

BinaryBackend.block/4 re-applies default callbacks on concrete tensors;
wrapping those with Expr.metadata leaked traced results on forward.
Tensor-only guards skipped stop_grad({x, y}) and broke vectorized metadata tests.
@Chapaman Chapaman closed this Aug 8, 2026
@Chapaman
Chapaman deleted the pv-guard-custom-grad-stop-grad-non-expr branch August 8, 2026 00:20
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.

1 participant