Repository navigation
Conversation
bhimrazy
requested review from
k223kim,
lianakoleva and
tejapulagam
as code owners
September 24, 2026 11:11
bhimrazy
added this pull request to stack #2849
September 24, 2026 11:12
bhimrazy
force-pushed
the
bhimrazy/autograd-fwd-tuple-output
branch
from
September 24, 2026 12:29
2a8167f to
9b06fc3
Compare
Since torch 2.12, the fwd subgraph dynamo builds returns its outputs as a tuple, and the caller indexes it: return ((y,), (l_x_,)) getitem = autograd_function_apply[0] python_return(*sequencify(output)) unpacked a one-element tuple to the bare tensor, so [0] indexed into the tensor instead, and thunderfx returned a scalar where eager gives f32[2]. test_higher_order_inplace_alias_update: AssertionError: The values for attribute 'shape' do not match: torch.Size([]) != torch.Size([2]). Return the structure the graph produced. Bare and multi-element outputs are unchanged.
bhimrazy
force-pushed
the
bhimrazy/autograd-fwd-tuple-output
branch
from
September 24, 2026 13:44
9b06fc3 to
f264a8a
Compare
lianakoleva
approved these changes
Sep 24, 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.
What does this PR do?
Keeps the tuple that the
autograd_function_applyfwd graph returns, so thunderfx gives the right shape again.Problem: since torch 2.12, the fwd subgraph dynamo builds returns its outputs as a tuple, and the caller indexes it:
thunder's lookaside unpacked a one-element tuple to the bare tensor, so
[0]indexed into the tensor, and thunderfx returned a scalar where eager givesf32[2].Fix: return the structure the graph produced. Bare and multi-element outputs are unchanged.
Related CI:
test_higher_order_inplace_alias_update, the last failure in the core jobs on ubuntu, macOS and Windows.Error, torch 2.14, with the rest of this stack
Part 9 of the breakdown of #2832.