Skip to content
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

[Hexagon] F2qi avgpool bug fix #15599

Merged
merged 1 commit into from
Sep 15, 2023
Merged

Conversation

rasagna-quic
Copy link
Contributor

We see an accuracy issue when FQ2I is enabled for the avg_pool2d op in the deeplab_v3 QAT model. The error seems to be happening because the underlying graph has the output of the avg_pool mapped directly to the conv2d without a quantize-dequantize layer in between.

Graph of interest

graph TD;
W(dequantize: A_scale, A_zero_point) --> Conv2d;
A(dequantize: B_scale, B_zero_point) --> avg_pool2d;
avg_pool2d --> Conv2d;
Conv2d --> Output(quantize: C_scale, C_zero_point);
Loading

Quantization parameters after Fq2i pass:
qnn.avg_pool2d (Bs, Bz, Cs, Cz)
qnn.conv2d (Cs, Cz, As, Az)
qnn.requantize (Cs*As, 0, Cs, Cz)

Proposed fix for quantization parameters:
qnn.avg_pool2d (Bs, Bz, Bs, Bz)
qnn.conv2d (Bs, Bz, As, Az)
qnn.requantize (Cs*As, 0, Cs, Cz)

where quantized parameters As, Bs, Cs are scales and Az, Bz, Cz are zeropoints.

@tvm-bot
Copy link
Collaborator

tvm-bot commented Aug 21, 2023

Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.

  • No users to auto-tag found, no teams are specified in PR title See #10317 for details

Generated by tvm-bot

@rasagna-quic
Copy link
Contributor Author

@rasagna-quic
Copy link
Contributor Author

@tvm-bot rerun

1 similar comment
@quic-sanirudh
Copy link
Contributor

@tvm-bot rerun

@rasagna-quic rasagna-quic force-pushed the f2qi_avgpool branch 4 times, most recently from ff03176 to 344988d Compare September 13, 2023 06:08
@rasagna-quic rasagna-quic changed the title F2qi avgpool bug fix [Hexagon] F2qi avgpool bug fix Sep 15, 2023
@kparzysz-quic kparzysz-quic merged commit 08a6ee5 into apache:main Sep 15, 2023
@kparzysz-quic
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants