Skip to content

Enable quantization for EDSR #456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions examples/quantization/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
def verify_xnnpack_quantizer_matching_fx_quant_model(model_name, model, example_inputs):
"""This is a verification against fx graph mode quantization flow as a sanity check"""

if model_name == "edsr":
# EDSR has control flows that are not traceable in symbolic_trace
return
if model_name == "ic3":
# we don't want to compare results of inception_v3 with fx, since mul op with Scalar
# input is quantized differently in fx, and we don't want to replicate the behavior
# in XNNPACKQuantizer
return

model.eval()
m_copy = copy.deepcopy(model)
m = model
Expand Down Expand Up @@ -72,11 +81,6 @@ def verify_xnnpack_quantizer_matching_fx_quant_model(model_name, model, example_
after_quant_result_fx = m_fx(*example_inputs)

# 3. compare results
if model_name == "ic3":
# we don't want to compare results of inception_v3 with fx, since mul op with Scalar
# input is quantized differently in fx, and we don't want to replicate the behavior
# in XNNPACKQuantizer
return
if model_name == "dl3":
# dl3 output format: {"out": a, "aux": b}
after_prepare_result = after_prepare_result["out"]
Expand Down
1 change: 1 addition & 0 deletions examples/recipes/xnnpack_optimization/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ class OptimizationOptions(object):
"resnet50": OptimizationOptions(True, True),
"vit": OptimizationOptions(False, True),
"w2l": OptimizationOptions(False, True),
"edsr": OptimizationOptions(True, False),
}