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

Add support for (de/re)quantization with shift #27481

Merged

Conversation

wojtuss
Copy link

@wojtuss wojtuss commented Sep 22, 2020

PR types

New features

PR changes

OPs

Describe

This patch adds support for quantization with shift (aka asymmetric quantization). The support is required by the fusion_gru op quantization (#27330).

Quantization with shift is performed according to the formula:

out_u8 = in_f32 * scale + shift

When shift is nonzero, the output of quantization is always of unsigned int8 data type.
Dequantization formula is:

out_f32 = in_u8/scale - shift/scale

Dequantization with shift expects unsigned int8 input.

Support in quantization passes will come in a separate PR.

@wojtuss
Copy link
Author

wojtuss commented Sep 23, 2020

@luotao1 ,
It seems the builds fail because of some issues with downloading data or models. I have restarted them, but the issue persists. Could you please help with it?

@luotao1
Copy link
Contributor

luotao1 commented Sep 23, 2020

It seems the builds fail because of some issues with downloading data or models.

#27502 is merged, you can restart it again.

@wojtuss
Copy link
Author

wojtuss commented Sep 25, 2020

@luotao1 ,
The test test_api_impl in the PR-CI-Pretest-Ignore build seems to fail independently of this PR. Could you please help with it?

@luotao1
Copy link
Contributor

luotao1 commented Sep 25, 2020

I see all required CI passed

@wojtuss wojtuss force-pushed the wojtuss/quantization-with-shift branch from 6296583 to 842c9ee Compare September 28, 2020 11:41
Copy link
Contributor

@grygielski grygielski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@luotao1 luotao1 merged commit 42d1753 into PaddlePaddle:develop Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants