commit | 961f27c5e8695e4a941bade8bdfa0a5bb3a516e1 | [log] [tgz] |
---|---|---|
author | Tommy Chiang <ototot@google.com> | Wed Jul 09 16:32:01 2025 |
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Jul 10 04:34:47 2025 |
tree | db63377fc06a8bf46f979e15e9cea27f17dc41b7 | |
parent | a964217d52f816b7c55e4222f11ce5d38e21f248 [diff] |
tflite: Compute numbers in float16 to match the NPU behavior If we compute numbers in float32, the error will accumulate, so there are chances that it eventually exceed the threshold. For example, when computing 0.375732 + 0.298828 - 0.641113 in float32, the result is 0.0334473, but it will be 0.0336914 in float16. Note that 0.375732 + 0.298828 = 0.674561(fp32) or 0.674805(fp16). To address the issue, we compute numbers in float16 to mimic the same calculation in NPU. BUG=b:430326201 TEST=`./async_delegate_test --stable_delegate_settings_file=/etc/ml_core/stable_delegate_settings.json;` on screebo and hylia passes 3000 times. Change-Id: Iea8c46ce83150cc592ddb8c114287b00f63ab67f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/tflite/+/6719772 Auto-Submit: Tommy Chiang <ototot@google.com> Commit-Queue: Shik Chen <shik@chromium.org> Tested-by: Tommy Chiang <ototot@google.com> Reviewed-by: Shik Chen <shik@chromium.org>
This repository hosts the core ChromeOS TFLite components, enabling on-device machine learning (ODML) workloads accelerated by NPU.
The corresponding ebuild can be found at: tensorflow-9999.ebuild
Patches are stored in the patch/
directory and explicitly listed in WORKSPACE.bazel
. A helper script, ./script/patcher.py
, is included to facilitate patch management within a TFLite workspace.
The typical workflow:
Eject (Download) TensorFlow Source Code
Download the TensorFlow source code into a local git repository with patches applied as individual commits:
./script/patcher.py eject
This creates a new local git repository at tensorflow/
.
Modify the TensorFlow Repository
Make changes to the tensorflow/
repository as needed, following standard git workflows. Optionally, include a PATCH_NAME=
tag in commit messages to specify the filename of the corresponding patch.
Seal the Repository
Regenerate the patch files and update the WORKSPACE.bazel
file:
./script/patcher.py seal
This updates the patches in the patch/
directory and reflects the changes in WORKSPACE.bazel
.
It's preferred to submit changes to upstream TensorFlow first and cherry-pick them as patches. This helps minimize divergence and makes TensorFlow updates easier.