There can be functions beyond round() that aren't present within the std::
namespace depending on libstdc++ version. This CL adds an indirection layer
using a new TF_MICRO_USE_GLOBAL_CMATH_FUNCTIONS flag to select these functions
and converts TfLiteRound() to use this layer.
Other similar indirections will be added in future CLs.
PiperOrigin-RevId: 303425632
Change-Id: Idfe14924329827f71742ab6aedfd6ead9bcb0dbb
Current the visualization script for TensorFlow Lite files only works if you build through Bazel. To make it more accessible, this change uses Flatbuffer's new Python interface to extract the information from the file, rather than calling out to an external tool. It also adds some tests.
A lot of the changes here are related to upgrading to the latest version of Flatbuffers, which has an impact on other parts of the code.
PiperOrigin-RevId: 291255530
Change-Id: I28a64a182e6197a58926d02c41988e4791c60fce
Current the visualization script for TensorFlow Lite files only works if you build through Bazel. To make it more accessible, this change uses Flatbuffer's new Python interface to extract the information from the file, rather than calling out to an external tool. It also adds some tests.
A lot of the changes here are related to upgrading to the latest version of Flatbuffers, whi...
PiperOrigin-RevId: 290887928
Change-Id: I90403c1f4233f472ee5d7c4d21eed8233cb7d008
Current the visualization script for TensorFlow Lite files only works if you build through Bazel. To make it more accessible, this change uses Flatbuffer's new Python interface to extract the information from the file, rather than calling out to an external tool. It also adds some tests.
A lot of the changes here are related to upgrading to the latest version of Flatbuffers, which has an impact on other parts of the code.
PiperOrigin-RevId: 290788860
Change-Id: I4db3442110c48e01da2b5696b693562c806735fd
- state is quantized to 16 bits.
- time weight is also quantized to 16bits but the target range is [-512, 512] instead of [-32767, 32767] because there is a "reduce" operation right after element-wise mul between state and time weight. The "reduce" can be as high as 30 so we reserve 6 bits (64) for the summation, leaving only 10 bits for time weight.
PiperOrigin-RevId: 286920154
Change-Id: I45104b69452a1033db230d1db6bd280fa289b733
- peephole coefficients are quantized to 16 bits symmetric. Int16 is used because the calculation is a 16x16 vector vector elementwise multiplication.
- without projection, hidden tensor becomes the output and reuses the quantization parameters of the output
- with layer normalization, the gate matmul uses intermediate result as output; without layer normalization, gate matmul is fed into activation directly so 2^(-12) is the output scale.
PiperOrigin-RevId: 284230412
Change-Id: Ibfa66dc6fc2614de28b0ba92e8fb2d42a338aab4
There is a bug in the current implementation of the operator PACK.
The multiple inputs should be requantized.
The current PR fixes this bug and adds a test for the quantization of the PACK operator.
Change-Id: Id829a6c62ea35b6b1b64c41797c02a924c14064a
The C types in lite/c/c_api_internal.h are not actually internal,
rather, they are common types used throughout the C++ and C APIs.
Rename the header accordingly.
PiperOrigin-RevId: 282494601
Change-Id: Ia784f35724d774db256ffcbbcdc5bb00e6574417
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
(1) quatization_wrapper is the external interface to help calibration and quantization. The interface is string and bool so the dependencies are minimal. It has two functions:
- CreateCalibrationModel copies a model to a new location and adds intermediate tensors if any of the op need that.
- CreateQuantizedModel quantizes a model in place.
(2) quatization wrapper_utils is the helper function for quatization_wrapper
- added function to load model
- added function to write model
PiperOrigin-RevId: 280510873
Change-Id: I58891d6e8d6d3b485242f321466ac91ce2fdffda