Skip to content

Commit 3624778

Browse files
committed
add is_submodule check
1 parent 5f97665 commit 3624778

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

exir/backend/backend_api.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,8 @@ def _insert_lowered_submodule(
227227
inp_node.args[0].all_input_nodes[0].name,
228228
)
229229
)
230-
output_node = [
231-
node for node in subgraph.graph.nodes if node.name == "output"
232-
][0]
230+
output_node = list(subgraph.graph.nodes)[-1]
231+
assert output_node.op == "output"
233232
call_submodule_inputs.append(output_node.all_input_nodes[inp_node.args[1]])
234233
else:
235234
call_submodule_inputs.append(inp_node)
@@ -356,7 +355,8 @@ def _partition_and_lower_one_graph_module(
356355

357356
# perform validation here to make sure all the delegated submodules are gone
358357
# validate inside _insert_lowered_submodule will break multi-method scenario
359-
owning_program._validate()
358+
if not is_submodule:
359+
owning_program._validate()
360360
return tagged_graph_module
361361

362362

@@ -665,7 +665,8 @@ def lower_all_submodules_to_backend(
665665

666666
# perform validation here to make sure all the delegated submodules are gone
667667
# validate inside _insert_lowered_submodule will break multi-method scenario
668-
owning_program._validate()
668+
if not is_submodule:
669+
owning_program._validate()
669670

670671

671672
@dataclass

0 commit comments

Comments
 (0)