Skip to content

Commit 09e5a93

Browse files
ezyangpytorchmergebot
authored andcommitted
Improve graph output alias with subclass error message (#159619)
Signed-off-by: Edward Z. Yang <ezyang@meta.com> Pull Request resolved: #159619 Approved by: https://github.com/albanD
1 parent 908c5cc commit 09e5a93

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

torch/_functorch/aot_autograd.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,15 @@ def _dup_fake_script_obj(fake_flat_args):
637637

638638
if fw_metadata.num_intermediate_bases > 0:
639639
assert not req_subclass_dispatch, f"""\
640-
torch.compile is currently being used with tensor subclass inputs:
641-
{",".join([str(type(x)) for x in fake_flat_args])}. We are attempting to a compile a graph with two graph outputs
642-
that alias one another, which is currently unsupported in the subclass use case. If you run into this,
643-
please file a github issue"""
640+
torch.compile is currently being used with tensor subclass inputs.
641+
We are attempting to a compile a graph with two graph outputs
642+
that alias one another, specifically output indices:
643+
644+
{[i for i, x in enumerate(fw_metadata.output_info) if x.output_type == OutputType.alias_of_intermediate]}
645+
646+
ANY output aliasing (even for regular tensors) is currently unsupported if
647+
there are any subclass outputs. If you run into this, please file a github
648+
issue"""
644649

645650
if aot_config.is_export:
646651
# aot_export: ban input metadata mutations for now to keep shared code paths simpler.

0 commit comments

Comments
 (0)