Skip to content

Commit 5318baa

Browse files
zhxchen17facebook-github-bot
authored andcommitted
Fix forward test failure.
Summary: Trying to fix this test https://www.internalfb.com/intern/test/562950062596904/ Reviewed By: tugsbayasgalan Differential Revision: D52552898 fbshipit-source-id: fb8311f9d979ebfd3306efaac5df812766aa899b
1 parent 32fee14 commit 5318baa

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

exir/lowered_backend_module.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ def _get_new_signature(
436436
)
437437
)
438438
if node.op == "output":
439-
for output in node.all_input_nodes:
439+
for output in pytree.tree_leaves((node.args, node.kwargs)):
440+
if not isinstance(output, torch.fx.Node):
441+
continue
440442
output_specs.append(
441443
OutputSpec(
442444
kind=OutputKind.USER_OUTPUT,

exir/program/_program.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ def _get_updated_graph_signature(
6161
Update the graph signature's user_input/user_outputs.
6262
"""
6363
new_input_specs = []
64-
for i, node in enumerate(new_gm.graph.nodes):
64+
i = 0
65+
for node in new_gm.graph.nodes:
6566
if node.op != "placeholder":
66-
break
67+
continue
6768

6869
assert i < len(
6970
old_signature.input_specs
@@ -77,6 +78,7 @@ def _get_updated_graph_signature(
7778
new_input_specs.append(
7879
InputSpec(old_input_spec.kind, arg, old_input_spec.target)
7980
)
81+
i += 1
8082

8183
output_node = list(new_gm.graph.nodes)[-1]
8284
assert output_node.op == "output"

0 commit comments

Comments
 (0)