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
Tests for minimum/maximum quantization quantization #34484
Tests for minimum/maximum quantization quantization #34484
Conversation
Problem description: MINIMUM and MAXIMUM operations were not quantized properly. Specifically, the problem was that only one of the inputs was quantized while another one was left in the original data type. Because of this reason, TFLite interpreter was failing to prepare since quantization params of ops did not match. Problem cause: MINIMUM and MAXIMUM operators were created in the way that they only had one input, not two. Hence when looping through inputs while quantizing them, only one of two inputs was quantized. Problem fix: Change the definition of the aforementioned properties. This patch contains fixes for the problem described above. Properties of MINIMUM and MAXIMUM operators were altered to have two inputs rather than one. This is safe since both 1.* and 2.* branches have only two inputs for these ops Test suite for testing Minimum and Maximum ops quantization is added Two small binaries have been added for testing purposes Change-Id: Ibcbfbf7bb7118a9f2cdd8ddc03e990015ba539d7
In case of multiple inputs, we need to requantize all inputs to have the same scale and zero point. Change-Id: Ie1373f385c166eeca1521457195c5356c41c3d11
In case of multiple inputs, we need to requantize all inputs to have the same scale and zero point. Change-Id: I903b278db8338b5b1da3d267ff6c258db09bcfef
Change-Id: Iaaf36acdc6df7194336d76d26ded8a2f03ce56d9
…to fix_minimum_maximum Change-Id: I6039b4bcd283201cfb6a17b17fc5d4c4c7f7ccfe
@wwwind Can you please resolve conflicts? Thanks! |
Comment from Anton: Reply: |
The c++ tests would still be welcome additions though. Thanks! |
Change-Id: I501414fdf7a769dbd027c6913029c14cc8ca1e06
Hi Suharsh, In our original fix we kept the fixed number of inputs to 2, but, yes, arbitrary_inputs variable solves the issue. I removed traces of the original fix and left only C++ tests. Thanks! |
@wwwind Could you please address Ubuntu Sanity errors? Thanks! |
Change-Id: Ife08ec56980a71e778ea86cf34c5a9fc2153a3f0
Hi @suharshs, could you please take a look again ? I had to push a fix for the sanity check - there was a small complaint from the buildifier. |
PiperOrigin-RevId: 285789493
Problem description:
MINIMUM and MAXIMUM operations were not quantized properly. Specifically, the problem was that only one of the inputs was quantized while another one was left in the original data type. Because of this reason, TFLite interpreter was failing to prepare since quantization params of ops did not match.
Problem cause:
MINIMUM and MAXIMUM operators were created in the way that they only had one input, not two. Hence when looping through inputs while quantizing them, only one of two inputs was quantized.
Problem fix:
Change the definition of the aforementioned properties.
This patch contains fixes for the problem described above.
two inputs rather than one. This is safe since both 1.* and 2.* branches
have only two inputs for these ops
This is an updated version of the PR. The old PR was raised by KonstantinARM, who has left ARM.