Skip to content

Commit 527302e

Browse files
lucylqfacebook-github-bot
authored andcommitted
remove duplicate deepcopy
Summary: Program is deep copied inside backend_api before being passed to preprocess: https://www.internalfb.com/code/fbsource/fbcode/executorch/exir/backend/backend_api.py?lines=106 And then deepcopied again here. Differential Revision: D55133796
1 parent 9c20929 commit 527302e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

backends/xnnpack/xnnpack_preprocess.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def preprocess(
8686
edge_program: ExportedProgram,
8787
compile_specs: List[CompileSpec],
8888
) -> PreprocessResult:
89-
ep = copy.deepcopy(edge_program)
9089
# Need to wrap EP here because xnnpack does addmm to linear
9190
# transforms. This makes resulting graph not aten compliant
9291
# as aten.linear is not a core aten op.
@@ -97,17 +96,17 @@ def preprocess(
9796
# EdgeDialectVerifier, but disable it.
9897
# TODO (task link) to implement NullVerifier or something similar
9998
ep = ExportedProgram(
100-
root=ep.graph_module,
101-
graph=ep.graph,
102-
graph_signature=ep.graph_signature,
103-
state_dict=ep.state_dict,
104-
range_constraints=ep.range_constraints,
105-
module_call_graph=copy.deepcopy(ep.module_call_graph),
106-
example_inputs=ep.example_inputs,
99+
root=edge_program.graph_module,
100+
graph=edge_program.graph,
101+
graph_signature=edge_program.graph_signature,
102+
state_dict=edge_program.state_dict,
103+
range_constraints=edge_program.range_constraints,
104+
module_call_graph=edge_program.module_call_graph,
105+
example_inputs=edge_program.example_inputs,
107106
verifier=EXIREdgeDialectVerifier(
108107
check_edge_ops=False, enable=False, class_only=True
109108
),
110-
constants=ep.constants,
109+
constants=edge_program.constants,
111110
)
112111

113112
passes = []

0 commit comments

Comments
 (0)