Running the same model in TF and TFLiteMicro produces different outputs #66358
Labels
comp:lite
TF Lite related issues
comp:micro
Related to TensorFlow Lite Microcontrollers
type:bug
Bug
Issue type
Bug
Have you reproduced the bug with TensorFlow Nightly?
Yes
Source
source
TensorFlow version
latest
Custom code
No
OS platform and distribution
both Linux and Windows
Mobile device
No response
Python version
latest
Bazel version
No response
GCC/compiler version
latest
CUDA/cuDNN version
No response
GPU model and memory
No response
Current behavior?
I have trained float point tf model and converted it to 8bit .tflite model. I run this .tflite model on the same test input in two environments, both on the same PC with linux (no ):
Problem: Running the same .tflite model/same input in these two different environments produces different outputs. Given that the (very small and simple) model is already heavily quantized, I am expecting to get bit-exact output, whereas I observe the output difference that is beyond some sort of rounding error. In the process of debugging, I narrowed down to one of the kernels that produces not-bit-exact result: Fully_Connected. The source code for this kernel under environment (2) lives here (line 65):
https://github.com/tensorflow/tflite-micro/blob/main/tensorflow/lite/kernels/internal/reference/fully_connected.h
Main Question: Can you point me to the source code of fully_connected computations for the environment (1) so I can compare the computations to the ones for the environment (2) and figure out myself where the output difference comes from? I understand that in (2) python calls precompiled C/C++ kernels, and I would like to see the source code of fully_connected (and other standard kernels such as conv2d) that was used for pre-compiling.
Note: I think the following code is being used in environment (1), however it is still not at the deep level where i can clearly see the matrix multiplication -> add bias -> rescale sequence of fully_connected operations that I can compare with the source code above for the environment (2)
Standalone code to reproduce the issue
Relevant log output
No response
The text was updated successfully, but these errors were encountered: