-
Notifications
You must be signed in to change notification settings - Fork 74k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Sum op kernel bug for models with int8/uint8 input.
Fixes two bugs: * The non-quantized sum kernel was being called for models with quantized inputs, resulting in incorrect results due to integer overflow. * The optimized version of QuantizedMeanOrSum was not clamping values after executing the computation, resulting in overflow in some cases. For the first issue, there was a problematic predicate for determining whether to use quantization-aware kernels for the sum op. Before this change, inputs had to be of type int8/uint8 and inputs/outputs had to have different scales and zero points in order to qualify. The latter criteria has been removed. One additional change worth noting (not quite sure it can be categorized as a bug): before this change, only the reference version of QuantizedMeanOrSum was being called. This change enables either the reference or optimized version to be called depending on the specified kernel_type. PiperOrigin-RevId: 538835574
- Loading branch information
1 parent
61c4900
commit ca55d1c
Showing
3 changed files
with
62 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters