Commit graph

175 commits

Author SHA1 Message Date
Esun Kim
7914a2d7a1
Clean-up unused bzl load (#3576) 2026-05-26 22:55:55 +00:00
Ryan Kuester
068c6a59b6
build(bazel): inject tflite_micro shim via tflm_py_* wrappers (#3573)
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.
2026-05-26 19:51:58 +00:00
Esun Kim
9f5ac257ee
No tensorflow 2 (#3548) 2026-05-06 21:17:46 +00:00
Esun Kim
807c35d6a9
Bazel Module (#3364)
* Work

* Review update

* Enabled tests

* Bazel: Suppress warnings from external repositories

* Fixed whl_test

* Formatted

* More format
2026-02-11 14:11:47 -08:00
Esun Kim
183da3e302
Typo in code (#3447)
* Typo in code

* Format
2026-02-11 20:34:42 +00:00
Esun Kim
d7f46b6fb7
[Doc] Fix typos (#3446)
* Fix typos

* Typos

* More

* Last
2026-02-11 17:18:49 +00:00
Esun Kim
51bc0e8978
[T2] Refactor Group 3 (#3370)
* Refactor t2-3

* Fix

* Fix

* Fix API misuse
2026-02-03 17:28:07 +00:00
Esun Kim
e63f7e85a3
Deleted codegen (#3360) 2026-01-27 20:57:50 +00:00
Esun Kim
b41b1cb25e
Clean-up shebang (#3356) 2026-01-26 14:07:28 -08:00
Esun Kim
2aa6e12979
[CI] Reformat (#3347)
* Clean-up BUILD

* Added pyproject.toml

* Format gen

* Fix

* Fix format

* Fix
2026-01-24 21:13:38 -08:00
Esun Kim
233ff4715c
[CI] Windows Fixes (#3344)
* Fixes

* Exclude
2026-01-24 17:57:50 -08:00
Esun Kim
b1592615eb
Bazel windows (#3336) 2026-01-24 11:52:08 -08:00
Esun Kim
729f177872
Relax NoFeatureTest tolerance for Xtensa HiFi (#3301) 2026-01-20 07:54:54 -08:00
Shlomi Regev
e028871fb6
Missing signal opts (#3264)
* 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>
2026-01-14 08:01:24 +00:00
Esun Kim
fd33340e06
Revert "[CI] Replaced tensorflow with tensorflow-cpu (#3261)" (#3290)
This reverts commit 9cbf6e0403.
2026-01-12 11:19:37 -08:00
Esun Kim
9cbf6e0403
[CI] Replaced tensorflow with tensorflow-cpu (#3261)
* Replaced tensorflow with tensorflow-cpu

* Use tensorflow-cpu for bazel targets
2025-12-03 13:43:14 -08:00
Esun Kim
858f5a3edd
[CI] Removed six, updated absl_py (#3203)
* Removed ci/install_qemu.sh

* Removed six from direct deps

* Removed six from tflm-ci docker

* Use requirement(absl_py)

* New qemu-user
2025-09-25 14:37:39 -07:00
Esun Kim
ba753cef3e
[CI] Fix build (#3194)
- 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
2025-09-19 20:48:22 +00:00
Daniel Mangum
97166cf5db
Fix minor typo in sinwave model training script (#3127)
Fixes minor typo in sinwave model training script.

`bug=fixes typo`
2025-08-04 21:13:43 +00:00
suleshahid
bc68d362d6
Remove deprecated BUILD tags (#3091)
These tags have been deprecated and are unused now. Syncing with upstream and removing them from the BUILD files.

BUG=remove deprecated tags
2025-04-08 19:21:25 +00:00
fwcd
4b5f835e60
Fix typo in hello world example (#2925)
Co-authored-by: suleshahid <110432064+suleshahid@users.noreply.github.com>
2024-11-22 13:40:17 -08:00
Ryan Kuester
b68c655367
build(bazel): replace cc_* with tflm_cc_* in remaining TFLM code (#2768)
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
2024-11-15 05:08:54 +00:00
Ryan Kuester
11b15b3a81
build(bazel): introduce tflm_cc_* macros, refactoring away micro_copts (#2765)
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
2024-11-14 23:16:28 +00:00
RJ Ascani
6411584e33
Revert "update the tensorflow.lite to use ai-edge-litert for all python based…" (#2705)
Reverts tensorflow/tflite-micro#2702

BUG=#2703
2024-09-27 17:44:05 +00:00
RJ Ascani
bf2ba11d93
update the tensorflow.lite to use ai-edge-litert for all python based… (#2702) 2024-09-26 09:11:38 -07:00
David Davis
39f9f1912a
TFLM compression changes (2nd) (#2653)
@tensorflow/micro

Preparatory changes for upcomming PRs related to TFLM compression changes.

Add unit testing failure check macro.

bug=#2652
2024-08-06 17:36:03 +00:00
asraa
8c458fc48e
fix: fix path to train target in hello_world example (#2608)
BUG=cleanup
2024-06-18 20:13:15 +00:00
David Davis
8a1fe96cfd
Update documentation (#2565)
@tensorflow/micro

Update README with additional makefile targets for this example application.

bug=fixes #2561
2024-05-08 17:00:33 +00:00
Måns Nilsson
d308847975
Update examples and documentation for Arm(R) Corstone(TM)-300 FVP (#2503)
* 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
2024-03-15 22:29:09 +00:00
RJ Ascani
29526e413b
Replace tensorflow-cpu usage with tensorflow (#2396)
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
2024-02-23 00:35:22 +00:00
RJ Ascani
a3296d6a29
Disable DTLN test on hifimini & VP6 (#2391)
The new DTLN test is failing on HiFi Mini & VP6. This PR disables the test on those targets while being investigated.

BUG=b/319712246
2024-01-11 23:11:48 +00:00
RJ Ascani
7a63bce432
Revert "Compute output shapes for some kernels (#2356)" (#2390)
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
2024-01-11 22:24:58 +00:00
cad-audio
ca5358f468
DTLN example: (#2012)
Adding DTLN example to demonstrates LSTM layers on HiFi DSP and NOT for evaluating noise suppression quality.

BUG=none
2024-01-10 17:37:33 +00:00
Steven Toribio
95467d2066
removing usage of tflm_runtime and replacing usage with new runtime target target in g3 TFLM repo (#2375)
removing usage of `tflm_runtime` and replacing usage with new runtime target target in g3 TFLM repo

[g3 cl](https://critique.corp.google.com/cl/595884672)

BUG=[b/286456378](https://b.corp.google.com/issues/286456378)
2024-01-05 17:01:02 +00:00
Ryan Kuester
77f655c26c
build(bazel): add missing dep on python package pillow (#2371)
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
2024-01-03 18:55:32 +00:00
David Davis
bb54330fda
Compute output shapes for some kernels (#2356)
@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
2024-01-02 22:22:36 +00:00
RJ Ascani
b766947f5a
codegen: Add Bazel macro for inference library (#2366)
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
2023-12-21 00:57:49 +00:00
RJ Ascani
83bbff9a0e
Revert "SPACE_TO_BATCH_ND: update output tensor shape" (#2339)
Temporarily reverting so that we can reland with SpaceToBatch, BatchToSpace, Conv2D and ExpandDims output tensor resizing atomically.

Reverts tensorflow/tflite-micro#2335

BUG=#2338
2023-11-30 23:19:30 +00:00
David Davis
50433190cf
SPACE_TO_BATCH_ND: update output tensor shape (#2335)
@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 #2332 fixes #2319 #1646 #1629 #1231
2023-11-28 17:43:15 +00:00
RJ Ascani
ea4c7a6c15
Remove audio_preprocessor golden tests (#2277)
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
2023-10-17 18:21:15 +00:00
RJ Ascani
6ec8c54c5d
micro_speech: Add py_rules loads and import paths (#2276)
BUG=cleanup
2023-10-17 01:11:55 +00:00
David Davis
d5a83db0d0
Change micro_speech example (#2249)
@tensorflow/micro 

Create Python examples that use Signal Ops Library.
Create Python examples for micro_speech model prediction.
Update README documentation.
Update images.
Add additional speech sample files (silence, noise) to testdata directory.
Add audio preprocessing models to models  directory.
Update Bazel BUILD files.
Update Makefiles
Add micro_speech to project generation examples for bluepill
Disable micro_speech_test for Hexagon (b/302404477)

bug=fixes  #2248
2023-10-12 23:17:32 +00:00
RJ Ascani
0cc7719f41
Add python load rules to person detection utils (#2208)
http://cl/562046918

BUG=cleanup
2023-09-05 19:37:52 +00:00
Steven Toribio
ad83c8cf8c
Implementation preserve_all_tensors and GetTensor features in TFLM interpreter (#2181)
`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)
2023-08-28 17:49:16 +00:00
RJ Ascani
46ccaf8fb3
Remove unused and combine similar loads (#2165)
BUG=cleanup
2023-08-14 19:50:55 +00:00
Steven Toribio
80cb11b131
load()s are being added in preparation for changes being made to Blaze/Bazel (#2160)
`load()`s are being added in preparation for changes being made to Blaze/Bazel !

corresponding [google3 cl](https://critique.corp.google.com/cl/553849494)

BUG=[b/295216390](https://b.corp.google.com/issues/295216390)
2023-08-10 03:30:46 +00:00
RJ Ascani
e687c60812
Initialize test output variables (#2124)
BUG=b/290989355
2023-07-13 22:33:57 +00:00
pjpratik
7125afac4d
Update the train micro speech model code for Tensorflow 2.x compatibi… (#2098)
…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
2023-06-30 08:32:45 +00:00
RJ Ascani
c8079bb678
Use consistent paths in hello world README (#2066)
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
2023-06-17 00:32:03 +00:00
Ryan Kuester
b5da836410
refactor(python): move runtime to package-friendly directory structure (#2051)
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
2023-06-15 06:25:19 +00:00