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.
* Add missing optimizations for xtensa/ and hexagon/ to forntend ops under signal/
* Revert change to copyright year
* Fix wrong include paths
* Reorder include paths
* Move static inline functions out of the namespace block.
* Fix path to KissFFT
* Remove file that was added by mistake
* Realized a lot of these optimizations were already added under src/
* Reverted a few more files
* Fix compilation errors
* Porting Reduce_All reference operator porting from TFLite to TFLM (#3269)
* Sync files related to Reverse_V2 from TFLite
#3110
* PRelu Int16x8 support in RefC
* Fix code style in prelu_test.cc
* 1. Reverted the copyright year
* Resolved compilation error for Int8x8 test case
* Add Dynamic_Update_Slice support to TFLM
* Code style error correction
* Code style correction
* Replaced hard coded MaxDimensions to RuntimeShape::kMaxSmallSize
* 1. Added more test cases \n2.Removed unused code
* Updates for test failure on ARM
* Code style updates
* Updates on test case failure for ARM
* Updates on test case failure for ARM
* Code style updates
* Add Reduce_All reference operator support to TFLM
* Resolving HiFi build errors
---------
Co-authored-by: Esun Kim <veblush@google.com>
* Provide default values for uninitialized variable (#3282)
Switch-cases in decode_state_lut.cc don't assign a default value
to a local variables. On one version of ARM GCC (building for ARM cortex m33, this results in
a compiler error [-Werror=maybe-uninitialized].
BUG=451462435
* Add Ingenic MIPS port to README.md (#3255)
* Add Ingenic MIPS port to README.md
* Update README.md
Changed order of new board to be alphabetical
* Update README.md
Removed extra brackets making things look wrong.
---------
Co-authored-by: Esun Kim <veblush@google.com>
* Solve compiler errors in decode op (#3284)
1. When building with old Xtensa toolchains, the compiler throw an unused variable warning
which is treated as error (-Werror is defined by default).
The cause is ScopedMicroProfile instantiation in the decoder op. Added a dummy reference to mute the warning.
2. Old pre C++14 Xtensa compilers don't support ticks in preprocessor constants, e.g. 0x8000'0000
Removed the ticks.
BUG=451462435
* Fix coding style
* Match FFT int16 test's tolerance with audiofrontend's
* Fix failure in micro_speech example
* Increase tolerance of feature extraction
* Incerased error interval for micro speech detection
* Incerased error interval for micro speech detection
* Incerased error interval for micro speech detection
* Incerased error interval for micro speech detection
* Comment on looser tolerance in micro speech test and limit it to Xtensa
---------
Co-authored-by: Kunasi Ramesh <28750242+rameshkunasi@users.noreply.github.com>
Co-authored-by: Esun Kim <veblush@google.com>
Co-authored-by: Matthew Vance <yinzara@gmail.com>
- 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
Replace cc_* targets remaining in TFLM code with tflm_cc_*
targets. These are targets which did not formerly use the common
copts. Avoid changing imported TFLite code, if for no other
reason than to avoid merge conflicts during the automatic sync
with upstream TFLite.
BUG=#2636
Remove micro_copts() by replacing every cc_* target that used
them with a tflm_cc_* equivalent, and setting those common copts
in one place, inside the tflm_cc_* macro.
This is the first of several commits introducing tflm_cc_* macros
in place of cc_binary, cc_library, and cc_test. Motivated by the
upcoming need to support conditional compilation, the objective
is to centralize build configuration rather than requiring (and
remembering that) each cc_* target in the project add the same
common attributes such as compiler options and select()ed
Alternatives such as setting global options on the command line
or in .bazelrc, even if simplified with a --config option, fail
to preserve flags and hooks for configuration in the case TFLM is
used as an external repository by an application project. Nor is
it easy in that case for individual targets to override an
otherwise global setting.
BUG=#2636
* Updates benchmark documentation.
* Updates benchmarks and network tester example.
* Select only needed ops for memory measurements.
* Only pip install if needed.
* Also gen folder output will be created differently depending on also toolchain and type of kernels
BUG=documentation for the benchmark application is not correct
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
This change broke some internal models, so reverting this until we can better understand why.
This also reverts PR #2383. When relanded, both should go back in together.
BUG=b/318738218
Add an undeclared dependency on the Python package `pillow` to the example
mnist_lstm. The missing dependency causes run and test failures on a system
where pillow isn't installed system-wide.
BUG=see description
@tensorflow/micro
Update the output tensor shape during prepare phase when the computed shape does not match the shape in the flatbuffer.
Kernels:
- BATCH_TO_SPACE_ND
- SPACE_TO_BATCH_ND
- CONV
- RESHAPE
- EXPAND_DIMS
- DEPTHWISE_CONV
Update CMSIS_NN and ARC_MLI optimized kernels.
Add additional tests from TfLite for BATCH_TO_SPACE_ND and SPACE_TO_BATCH_ND.
Update existing tests.
Add tests for Keras model using convolution with dilation > 1.
Update memory_arena_threshold_test to increase total, tail, and persistent allocation sizes:
- Add 20 bytes for CONV output shape
- Add 15 bytes for arena allocation alignment
- x2 convolution layers
Update micro_speech_test arena size as per description in C++ code.
See #2319 for additional details.
Resolves [b/317362237](https://issuetracker.google.com/317362237)
bug=fixes #2368#1646#1629#1231#2338#2319
The TFLM code_generator takes a TFLite model and generates C/C++ source code that can then be compiled into a binary. This change adds a Bazel macro for invoking the code generator and creating a cc_library with the resulting sources. It also updates the checked-in hello_world example with an appropriate BUILD file and updates the script to use Bazel instead of make.
BUG=b/294230402
Temporarily reverting so that we can reland with SpaceToBatch, BatchToSpace, Conv2D and ExpandDims output tensor resizing atomically.
Reverts tensorflow/tflite-micro#2335
BUG=#2338
@tensorflow/micro
Update the output tensor shape during prepare phase when the computed shape does not match the shape in the flatbuffer.
Added additional tests from TfLite.
See #2319 for additional details.
Resolves [b/313360569](https://issuetracker.google.com/313360569)
bug=fixes #2332fixes#2319#1646#1629#1231
The AudioPreprocessorTest attempted to generate new models and compare them against known golden models to ensure that they were identical. However, this proves to be fragile, as the model may not match bit for bit. For example, resulting weights might be slightly different.
BUG=cleanup
`Implementation preserve_all_tensors and getTensor features in TFLM interpreter`
[Design Doc](https://docs.google.com/document/d/13CB93tffg_dDnZYy1QkY3u88yJev4PtZeRY0MLH6n_w/edit?resourcekey=0-htWqjXWneKLXcD6o2SVNJw#heading=h.x9snb54sjlu9)
* PreserveAllTensors is a flag / option being added to the TFLM interpreter that guarantees that post invocation all tensors will be available post invocation with there data untouched.
* GetTensor() is an api being added to the interpreter that allows users to access any tensor in a model by providing the right index but this api is only available when the PreserveAllTensors flag is being used (all the data is guaranteed to be valid and untouched)
*additionally this cl adds functionality for users to instantiate MicroAllocators with LinearMemoryPlanners vs the the default GreedyMemoryPlanner for MicroAllocator create methods that don't currently take a MemoryPlanner as an input
[google3 cl](https://critique.corp.google.com/cl/543518092)
BUG=[b/288141725](https://b.corp.google.com/288141725)
…lity
The latest colab does not support running 1.x version. The code has been updated to be able to run with 2.x version in the colab.
Thanks.
BUG=cleanup
The hello world example README.md contained a mix of paths to the bazel targets, with an implicit assumption that the working directory was either `tensorflow/lite/micro/examples/hello_world` or the project root. This CL updates the paths to consistently assume the current working directory is the project root for clarity.
BUG=doc cleanup
To package the module `runtime` as `tflite_micro.runtime`, put `runtime` under
a directory representing the Python namespace package `tflite_micro`. For
organization's sake, move it all to the top-level directory `python/`. Adjust
tests and docs to match.
Some code outside of the Python extension module has come to depend on
`python/tflite_micro:python_ops_resolver` as a replacement for
`all_ops_resolver` (e.g.:`t/l/m/integration_tests/seanet/add/integration_tests.cc`).
`python_ops_resolver` is intended to be a private implementation detail of the
Python extension module. For now, grandfather in the dependent code by updating
its references to the resolver's location; however, soon the dependent code
should be migrated away to a different resolver. (#2033,
https://issuetracker.google.com/286508251)
BUG=part of #1484