Skip to content

Commit ac035dc

Browse files
ethansfngfacebook-github-bot
authored andcommitted
remove convert in compiler_funcs (#13698)
Summary: Directly use convert_pt2e since we've moved custom handling out Reviewed By: zonglinpeng Differential Revision: D81065417
1 parent 18907e6 commit ac035dc

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

backends/cadence/aot/compiler.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import executorch.backends.cadence.aot.ops_registrations # noqa
1414
import torch
1515
from executorch.backends.cadence.aot.compiler_funcs import (
16-
convert as convert_fn,
1716
prepare as prepare_fn,
1817
trace as trace_fn,
1918
)
@@ -42,6 +41,7 @@
4241
from executorch.exir.program._program import to_edge
4342

4443
from torch.export.exported_program import ExportedProgram
44+
from torchao.quantization.pt2e.quantize_pt2e import convert_pt2e
4545

4646
from .passes import apply_exir_ops_passes, apply_torch_ops_passes
4747

@@ -139,7 +139,7 @@ def convert_pt2(
139139
Returns a GraphModule with the converted model.
140140
"""
141141

142-
converted_model = convert_fn(graph_module)
142+
converted_model = convert_pt2e(graph_module)
143143

144144
if dump_graphs:
145145
logging.info("Graph after convert:")

backends/cadence/aot/compiler_funcs.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111

1212
import torch
1313
from torch._inductor.decomposition import remove_decompositions
14-
from torchao.quantization.pt2e.quantize_pt2e import (
15-
convert_pt2e,
16-
prepare_pt2e,
17-
prepare_qat_pt2e,
18-
)
14+
from torchao.quantization.pt2e.quantize_pt2e import prepare_pt2e, prepare_qat_pt2e
1915
from torchao.quantization.pt2e.quantizer import Quantizer
2016

2117

@@ -56,8 +52,3 @@ def prepare(
5652
prepared_model = prepare_pt2e(traced_model, quantizer)
5753

5854
return prepared_model
59-
60-
61-
def convert(prepared_model: torch.fx.GraphModule) -> torch.fx.GraphModule:
62-
converted_model = convert_pt2e(prepared_model)
63-
return converted_model

0 commit comments

Comments
 (0)