Skip to content

Commit 48c0445

Browse files
jerryzh168facebook-github-bot
authored andcommitted
Enable quantization for EDSR
Summary: printed quantized model: https://www.internalfb.com/phabricator/paste/view/P834732421 can't verify against fx since symbolic_trace can't capture control flows Reviewed By: kimishpatel, guangy10 Differential Revision: D49524934
1 parent 2f24502 commit 48c0445

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

examples/quantization/example.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
def verify_xnnpack_quantizer_matching_fx_quant_model(model_name, model, example_inputs):
4444
"""This is a verification against fx graph mode quantization flow as a sanity check"""
4545

46+
if model_name == "edsr":
47+
# EDSR has control flows that are not traceable in symbolic_trace
48+
return
49+
if model_name == "ic3":
50+
# we don't want to compare results of inception_v3 with fx, since mul op with Scalar
51+
# input is quantized differently in fx, and we don't want to replicate the behavior
52+
# in XNNPACKQuantizer
53+
return
54+
4655
model.eval()
4756
m_copy = copy.deepcopy(model)
4857
m = model
@@ -72,11 +81,6 @@ def verify_xnnpack_quantizer_matching_fx_quant_model(model_name, model, example_
7281
after_quant_result_fx = m_fx(*example_inputs)
7382

7483
# 3. compare results
75-
if model_name == "ic3":
76-
# we don't want to compare results of inception_v3 with fx, since mul op with Scalar
77-
# input is quantized differently in fx, and we don't want to replicate the behavior
78-
# in XNNPACKQuantizer
79-
return
8084
if model_name == "dl3":
8185
# dl3 output format: {"out": a, "aux": b}
8286
after_prepare_result = after_prepare_result["out"]

examples/recipes/xnnpack_optimization/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ class OptimizationOptions(object):
2626
"resnet50": OptimizationOptions(True, True),
2727
"vit": OptimizationOptions(False, True),
2828
"w2l": OptimizationOptions(False, True),
29+
"edsr": OptimizationOptions(True, False),
2930
}

0 commit comments

Comments
 (0)