Skip to content

Commit 50a445a

Browse files
mcr229facebook-github-bot
authored andcommitted
fix quantized ic3/ic4/edsr examples
Summary: The fix for quantized ic3/ic4/edsr requires runnign the pass `convert_scalars_to_attrs` after capturing_pre_autograd_graph and before preparing and converting We add using this pass in the examples to fix the quantized ic3/ic4/edsr Differential Revision: D49850155 fbshipit-source-id: 7de6ddae4c702ce157963cd70fad898235afdbf8
1 parent ec390e2 commit 50a445a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

examples/backend/xnnpack_examples.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
1515
from executorch.exir import EdgeCompileConfig
1616
from executorch.exir.backend.backend_api import to_backend
17+
from torch.ao.quantization.quantizer.xnnpack_quantizer_utils import (
18+
convert_scalars_to_attrs,
19+
)
1720

1821
from ..export.utils import export_to_edge, save_pte_program
1922

@@ -77,6 +80,7 @@
7780

7881
if args.quantize:
7982
logging.info("Quantizing Model...")
83+
model = convert_scalars_to_attrs(model)
8084
model = quantize(model, example_inputs)
8185

8286
edge = export_to_edge(

0 commit comments

Comments
 (0)