Skip to content

Commit 38d988a

Browse files
eigen-kfacebook-github-bot
authored andcommitted
Move apply_torch_ops_passes() to _lower_ep_to_edge().
Summary: Make apply_torch_ops_passes() called by quantization API too. Previously quantize_and_export_to_edge() was not picking it up. Differential Revision: D78852189
1 parent 29c52b5 commit 38d988a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

backends/cadence/aot/compiler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@ def _lower_ep_to_edge(
233233
"""
234234
Lower an ExportedProgram to an EdgeProgramManager (in edge IR).
235235
"""
236+
# Apply passes which transform the ExportedProgram before it gets lowered to edge.
237+
expo_program = apply_torch_ops_passes(expo_program)
238+
236239
# Call to_edge to convert the graph to edge IR.
237240
# Note: dim_order is skipped (https://github.com/pytorch/executorch/issues/3704)
238241
edge_prog_manager = to_edge(
@@ -268,9 +271,6 @@ def export_to_edge(
268271
# Export the model into an ExportedProgram.
269272
expo_program = trace(model, inputs)
270273

271-
# Apply passes which transform the ExportedProgram before it gets lowered to edge.
272-
expo_program = apply_torch_ops_passes(expo_program)
273-
274274
# Lower the model to edge IR.
275275
edge_prog_manager = _lower_ep_to_edge(
276276
expo_program, dump_graphs, constant_methods, core_aten_exceptions

0 commit comments

Comments
 (0)