Python targets in this repository import one another under the
"tflite_micro" package namespace, which //:tflite_micro_shim synthesizes
at import time. The shim is required under Bzlmod, where the main
repository's runfiles root is the fixed name "_main" rather than the
module name, so the "tflite_micro" prefix no longer resolves on its own.
Every such target therefore had to list //:tflite_micro_shim in its
deps, which was repetitive and easy to forget.
Add tflm_py_library, tflm_py_test, and tflm_py_binary wrappers in a new
//python:py_rules.bzl that inject the shim dependency automatically,
following the naming convention of the existing tflm_cc_* wrappers, and
document the shim's rationale there. Convert every target that
previously listed the shim to the corresponding wrapper and drop the
explicit dependency. The dependency graph is unchanged; only the means
by which the shim is attached differs.
- Upgraded the Bazel BuildTool to the latest version (8.2.1).
- Updated the `tflm-ci` Docker image and pushed the new tag (0.6.1) to the `ghcr.io/tflm-bot/tflm-ci registry`.
- Updated the WORKSPACE to load `rules_cc` and `rules_shell` explicitly
- Ran `buildifier` to ensure all BUILD files to have all the fixes.
BUG=Clean-up
The tensorflow-cpu package does not support MacOS or non-x86 hardware. Replacing the tensorflow-cpu python package requirement with the tensorflow meta package should enable the bazel build and the dependent python scripts to be used on those platforms.
BUG=#2367, #1781
1. Make variable name c-style following python style guide
2. Move file IO out of convert_tflite_to_html function. File io make
testing this function hard
3. Avoid file write in test and other complaints discovered in importing
to internal
BUG=discovery these when importing
Since the html is not directly renderable by github, insert a png
to show the tool's output.
Also beautify the output slightly: calls out the number is for size
explicitly.
BUG=
* A tool to visualize tflite file with size info in html format
* remove redundant build target
* Add main to tflite_size and this allows the following usage:
bazel run flatbuffer_size -- input.tflite output.html
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>