Skip to content

Commit

Permalink
only collect fx node for user_visible_outputs when doing output strid…
Browse files Browse the repository at this point in the history
…e conversion (#106194)

For yolo3, there has a subgraph that output has int value, and AttributeError: 'int' object has no attribute 'name` caused by collecting ser_visible_outputs to do output stride conversion.  This PR will add a check only that the output is a fx node before being added in user_visible_outputs.

Pull Request resolved: #106194
Approved by: https://github.com/jgong5, https://github.com/eellison, https://github.com/shunting314
  • Loading branch information
XiaobingSuper authored and pytorchmergebot committed Jul 30, 2023
1 parent 888bddd commit eab3b26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion torch/_inductor/compile_fx.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,9 @@ def fw_compiler_freezing(
# for freezing, all graph outputs should be user visible
*_, model_outputs_node = opt_model.graph.nodes
model_outputs = model_outputs_node.args[0]
user_visible_outputs = [n.name for n in model_outputs]
user_visible_outputs = [
n.name for n in model_outputs if isinstance(n, torch.fx.Node)
]

# constant params will be real tensors, not fake
with unittest.mock.patch.object(fake_mode, "allow_non_fake_inputs", True):
Expand Down

0 comments on commit eab3b26

Please sign in to comment.