-
Notifications
You must be signed in to change notification settings - Fork 74k
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
[TFLite] Update MultiplyByQuantizedMultiplier to use single-rounding instead of double-rounding #50290
[TFLite] Update MultiplyByQuantizedMultiplier to use single-rounding instead of double-rounding #50290
Conversation
…f double-rounding
… outputs The change provides a more in-depth testing of the SUB operator. Previously the same scaling was used for both inputs and for the output, a simple subtraction in the kernel without any rescaling would have made the tests pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, please wait for others' opinions as well, thanks!
Thank you for the review. @renjie-liu I split the PR in two. The #50615 PR changes the SUB and DIV kernels to avoid the usage of negative quantized multipliers in |
@Tessil Can you please address Ubuntu Sanity errors? Thanks! |
@gbaned Thanks, the latest commit should fix it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Tessil.
Adapt to Tflite/TfliteMicro, which will use single rounding instead of double rounding: tensorflow/tensorflow#50290 Changes are added under flag CMSIS_NN_USE_SINGLE_ROUNDING, which is disabled by default.
Adapt to Tflite/TfliteMicro, which will use single rounding instead of double rounding: tensorflow/tensorflow#50290 Changes are added under flag CMSIS_NN_USE_SINGLE_ROUNDING, which is disabled by default.
Adapt to Tflite/TfliteMicro, which will use single rounding instead of double rounding: tensorflow/tensorflow#50290 Changes are added under flag CMSIS_NN_USE_SINGLE_ROUNDING, which is disabled by default.
Hello,
This PR changes the rounding of the int32
MultiplyByQuantizedMultiplier
methods to a single-rounding instead of a double-rounding in a way similar to what was done in google/ruy#227 and adapts the tests to the change.The new int32
MultiplyByQuantizedMultiplier
adds a restriction on the quantized multiplier, it must now be a positive integer in the same way as in the int64 version ofMultiplyByQuantizedMultiplier
. This restriction also matches the one in the quantization scaling defined in the TOSA specification. To achieve that the SUB and DIV operators were slightly adapted to avoid any negative quantized multiplier.Thibaut