Skip to content

Commit dc496c1

Browse files
mcr229facebook-github-bot
authored andcommitted
clean up TODOs
Summary: With Unified Partitioner (D48761226) and Duplicate Dequant Node (D48663147) pass landing, we can clean up the TODOs from this example _check_ir_validity is still required for quantization workflow as without it, it complains that quantized ops are not aten canonical Reviewed By: kirklandsign Differential Revision: D49129706 fbshipit-source-id: 306921aad603eca91d12bb5903ee931235018e40
1 parent 028d4a8 commit dc496c1

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

examples/backend/xnnpack_examples.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,9 @@
1111

1212
import torch._export as export
1313

14-
from executorch.backends.xnnpack.partition.xnnpack_partitioner import (
15-
XnnpackFloatingPointPartitioner,
16-
XnnpackQuantizedPartitioner,
17-
)
18-
from executorch.exir import CaptureConfig, EdgeCompileConfig
14+
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
15+
from executorch.exir import EdgeCompileConfig
1916
from executorch.exir.backend.backend_api import to_backend
20-
from executorch.exir.backend.canonical_partitioners.duplicate_dequant_node_pass import (
21-
DuplicateDequantNodePass,
22-
)
2317

2418
from ..export.utils import export_to_edge, save_pte_program
2519

@@ -81,30 +75,20 @@
8175
# pre-autograd export. eventually this will become torch.export
8276
model = export.capture_pre_autograd_graph(model, example_inputs)
8377

84-
partitioner = XnnpackFloatingPointPartitioner
8578
if args.quantize:
8679
logging.info("Quantizing Model...")
8780
model = quantize(model, example_inputs)
88-
# TODO(T161849167): Partitioner will eventually be a single partitioner for both fp32 and quantized models
89-
partitioner = XnnpackQuantizedPartitioner
90-
91-
capture_config = CaptureConfig(enable_aot=True)
9281

9382
edge = export_to_edge(
9483
model,
9584
example_inputs,
9685
edge_compile_config=EdgeCompileConfig(
97-
# TODO(T162080278): Duplicated Dequant nodes will be in quantizer spec
98-
_check_ir_validity=False
99-
if args.quantize
100-
else True,
86+
_check_ir_validity=False if args.quantize else True,
10187
),
10288
)
10389
logging.info(f"Exported graph:\n{edge.exported_program.graph}")
10490

105-
edge.exported_program = to_backend(
106-
edge.transform(DuplicateDequantNodePass()).exported_program, partitioner
107-
)
91+
edge.exported_program = to_backend(edge.exported_program, XnnpackPartitioner)
10892
logging.info(f"Lowered graph:\n{edge.exported_program.graph}")
10993

11094
exec_prog = edge.to_executorch()

0 commit comments

Comments
 (0)