Commit graph

1960 commits

Author SHA1 Message Date
dependabot[bot]
d5d27c829c
Bump actions/setup-python from 6 to 7
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 6 to 7.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-23 01:13:22 +00:00
David Davis
8f1f3b2623
WHILE operator input/output copy fix (#3633)
@tensorflow/micro

Remove extraneous tensor copy operation after first invocation of condition subgraph.

Move copy of operator inputs to outputs, such that it occurs before the first invocation of the condition subgraph. This preserves the operator inputs when one or more of them is the output of DECODE, and alternate decompression memory is in use. This is because the output of DECODE is for immediate consumption by the next operator in the graph (WHILE), yet it is possible for the WHILE subgraph invocations to share memory with the original DECODE output.

Update the unit test for multiple invocations of the condition and body subgraphs.

When copying tensors between operator inputs/outputs and subgraph inputs/outputs, check if the source and destination tensors share memory.

bug=fixes #3632
2026-07-20 17:58:59 +00:00
David Davis
0965635467
Fix benchmark tool alternate profiler (#3629)
@tensorflow/micro

Set the alternate profiler in the benchmark tool prior to the `Prepare` phase (before calling `MicroInterpreter::AllocateTensors`).  This is because the DECODE operator requires the alternate `MicroProfilerInterface` to already be initialized during the `Prepare` phase.

Previously the alternate profiler was only required during the `Eval` phase with the legacy compression code.  This fix does not change the functionality of the benchmark tool with respect to the legacy compression.

bug=#3628
2026-07-13 18:10:56 +00:00
TFLM-bot
35b20c5c74
Sync from upstream TF. (#3625) 2026-07-13 11:31:17 -07:00
TFLM-bot
fddd3707a3
Sync from upstream TF. (#3617) 2026-07-08 22:34:57 +00:00
Esun Kim
5750228374
Add Reset support to CircularBuffer op (#3618)
* Add reset support to circular_buffer

* Format
2026-07-08 21:34:43 +00:00
Esun Kim
bc0e8c658b
Re-enable 3D x 2D BatchMatMul dimension collapse for adj_x=true (#3599)
* Re-enable 3D x 2D BatchMatMul dimension collapse for adj_x=true

* Code style
2026-07-08 15:32:05 +00:00
Ryan Kuester
9664901486
feat(python): add alt decompression memory parameter to interpreter (#3614)
Add alt_decompression_memory_size parameter to the Python interpreter
API. When non-zero, allocates a separate memory region for DECODE
operator outputs and calls SetDecompressionMemory before AllocateTensors.

BUG=part of #3256
2026-07-06 16:38:39 +00:00
Esun Kim
e142972d4f
Manual sync from sync from github.com/tensorflow/tensorflow (#3616)
* Synced

* Added FLOAT8_* types
2026-07-01 18:13:01 -07:00
Esun Kim
fbda8b8d6b
Manual sync from sync from github.com/tensorflow/tensorflow (#3601)
* Synced

* No abseil
2026-07-01 14:46:41 -07:00
Esun Kim
ca0b8b1308
Added allow-unsafe-pr-checkout: true (#3615) 2026-07-01 13:59:22 -07:00
Arpit Jain
5fa112687b
ci: declare workflow-level contents: read on 3 workflows (#3558)
Pins the default GITHUB_TOKEN to contents: read on the workflows in
.github/workflows/ that don't call a GitHub API beyond the initial
checkout. The other workflows in this directory are left implicit
because they need write scopes that a maintainer is better placed
to declare.

Motivation: CVE-2025-30066 (March 2025 tj-actions/changed-files
compromise) exfiltrated GITHUB_TOKEN from workflow logs. Per-workflow
caps bound runtime authority irrespective of repo or org default,
give drift protection if the default ever widens, and are credited
per-file by the OpenSSF Scorecard Token-Permissions check.

YAML validated locally with yaml.safe_load.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
2026-06-30 16:47:20 -07:00
Ryan Kuester
6c67d478e3
feat(compression): add Huffman and Pruning compression support (#3612)
Add spec types, YAML parser support, and plugin stubs for Huffman and
Pruning compression methods. The plugins raise CompressionError when
invoked, to be replaced with working implementations later.

BUG=part of #3256
2026-06-30 22:53:59 +00:00
dependabot[bot]
5f54b5be28
Bump actions/checkout from 6 to 7 (#3609)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-30 22:26:08 +00:00
Esun Kim
aa7d6f9fd8
Added Error Handling & Defensive Programming Guide (#3539)
* Added Error Handling & Defensive Programming Guide

* Review
2026-06-30 22:24:50 +00:00
Esun Kim
b5acfb0355
Bazel 8.7.0 (#3610) 2026-06-30 15:23:57 -07:00
Aman Kumar
348eed01b6
docs: update deprecated Silabs repository link (#3579)
Updates the Silicon Labs machine learning applications link per issue 3556.
2026-06-25 16:51:59 -07:00
Ryan Kuester
9bfaeadf48
feat(compression): add LUT compression plugin (#3608)
Implement LutCompressor using the Compressor protocol. Lookup table
compression replaces tensor values with indices into a table of unique
values, producing packed indices and ancillary data in the format
expected by the TFLM DECODE kernel.

Supports per-tensor and per-channel compression, sizes value tables to
actual unique count, and handles unquantized tensors.

BUG=part of #3256
2026-06-24 22:44:48 +00:00
Måns Nilsson
acc13e42eb
Update CMSIS-NN download (#3607)
- Adapt build logic to not build float support since TFLM does not use
  the CMSIS-NN CMake path.

- Zero-initialize the cmsis_nn_lstm_context used by the int8 and int16
  unidirectional sequence LSTM paths so optional fields such as hidden_state do
  not contain stack garbage.

Change-Id: I5b44a3a231eb19023e004a5652b207930853648f

Signed-off-by: Måns Nilsson <mans.nilsson@arm.com>
2026-06-24 04:03:35 +00:00
Ryan Kuester
074b75f8ec
feat(compression): add Compressor protocol (#3590)
Define the plugin interface for compression methods. Each compressor
implements the Compressor protocol with a compress() method that returns
encoded data and ancillary data.

BUG=part of #3256
2026-06-18 20:15:56 +00:00
Esun Kim
7ca66d18e7
Ensure int64 accumulation for bias-less 16x8 ops in TFLM kernels (#3598) 2026-06-16 23:58:19 +00:00
Esun Kim
b6ee3dc974
Fix missing quantizedBiasType setting for 16x8 requantization (#3597) 2026-06-16 15:53:23 +00:00
Ryan Kuester
e0b2c281f2
feat(compression): add DECODE operator types and metadata (#3589)
Add decode module with DecodeType constants and DecodeCommonMetadata,
per the TFLM DECODE Operator Design document.

BUG=part of #3256
2026-06-06 01:31:13 +00:00
Ryan Kuester
eea46d3d61
chore(compression): remove test_models.py (#3587)
Remove test_models module and its tests, now superseded by
model_editor.

BUG=part of #3256
2026-06-04 18:44:14 +00:00
Ryan Kuester
ac1fae3619
refactor(compression): replace test_models with model_editor in compress_test (#3586)
Replace dictionary-based test_models.build() with model_editor's
declarative API for building test models.

BUG=part of #3256
2026-06-02 16:09:54 +00:00
Ryan Kuester
730449fef1
chore(compression): remove model_facade.py (#3585)
Remove model_facade module and its tests, now superseded by
model_editor.

BUG=part of #3256
2026-06-01 23:03:06 +00:00
Ryan Kuester
c2accf5c8f
refactor(compression): migrate compress.py from model_facade to model_editor (#3580)
Replace model_facade with model_editor in compress.py and tests.
model_editor provides a cleaner API with better buffer and metadata
handling.

Update BUILD dependencies accordingly.

BUG=part of #3256
2026-06-01 16:36:48 +00:00
Esun Kim
63819227bc
Fix cmsis-nn pooling (#3584) 2026-06-01 16:24:20 +00:00
Ryan Kuester
7c26381de5
feat(compression): implement model_editor for TFLite model manipulation (#3575)
Implement unified module for creating, reading, and modifying TFLite
models with a clean API. The module eliminates manual index tracking
and buffer management through automatic bookkeeping, supporting both
declarative and imperative construction styles.

Wrapper classes (Tensor, Operator, Subgraph, Model) hold the underlying
flatbuffer T objects as backing storage rather than copying fields into
dataclasses. This ensures all schema fields are preserved during
read-modify-write cycles, even fields not explicitly handled by
model_editor. Future schema additions will be preserved automatically.

Add comprehensive test coverage including field preservation tests that
verify unhandled schema fields survive read-modify-write.

BUG=part of #3256
2026-05-29 21:42:17 +00:00
Ryan Kuester
db550c38c9
refactor(compression): hoist numpy dtype map into tensor_type (#3578)
Add a tensor_type module that holds the single mapping from a TFLite
TensorType to a numpy dtype, and convert view.py to use it. The mapping
was inlined in view.py; centralizing it gives the compression tooling
one place to maintain as more callers need to read tensor buffers as
numpy arrays.

tensor_type.to_numpy() raises ValueError for types with no clean numpy
equivalent (STRING, RESOURCE, VARIANT, BFLOAT16, and the sub-byte
integer types) instead of silently returning a wrong dtype. Only types
with an unambiguous little-endian numpy representation are mapped.

BUG=part of #3256
2026-05-28 21:56:37 +00:00
Esun Kim
cc99d0597f
Removed batch_size assert in depthwise_conv (#3562) 2026-05-27 16:41:22 +00:00
Esun Kim
2ba41b0f3e
Fixed rank support in pad and min/max (#3563) 2026-05-27 16:41:17 +00:00
Esun Kim
67fd13064a
Format (#3577) 2026-05-27 06:39:06 -07:00
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
d0890bb456
Updated CMSIS_NN to the latest (6d9d61d) (#3565) 2026-05-21 22:05:29 +00:00
Esun Kim
ac2c346736
Fix (#3567) 2026-05-21 14:53:37 -07:00
Esun Kim
a9952453ab
Improve Check TfLite Files (#3566) 2026-05-21 14:40:16 -07:00
Esun Kim
9f5ac257ee
No tensorflow 2 (#3548) 2026-05-06 21:17:46 +00:00
Esun Kim
1c2bae841e
No tensorflow 1 (#3546)
* No tensorflow 1

* Vendoring our own utils

* Vendoering revise

* Removed unnecessary tf pythons

* Reformat
2026-05-06 18:31:12 +00:00
Esun Kim
cf8c42a16f
Align Conv INT16 accumulator logic with FullyConnected (#3537)
* Align Conv INT16 accumulator logic with FullyConnected

* Applied to optimized kernels

* Format fix
2026-05-06 13:02:51 +00:00
Esun Kim
51bee03bed
Default to 64-bit accumulation for 16x8 Fully Connected without bias (#3522) 2026-04-09 18:35:03 +00:00
Esun Kim
c36885e9e6
[Fix] Batch MatMul Op (#3413)
* Added BatchMatMulOpTestFloat32Test_BatchSizeTwo_Broadcast_LHSAdjoint

Added BatchMatMulOpTestFloat32Test_BatchSizeTwo_Broadcast_RHSAdjoint

* Fixed cmsis_nn/batch_matmul.cc
2026-04-09 18:34:59 +00:00
TFLM-bot
f97216c244
Sync from upstream TF. (#3488) 2026-03-31 14:00:31 +00:00
Nicolás Arrieta Larraza
f5302ed4fa
Add 16bit xtensa depthwise conv kernel support (#3481)
* Added 16x8 xtensa depthwise conv kernel

* Added int16 support only for HIFI5

* Code formatting
2026-03-18 16:23:13 +00:00
TFLM-bot
f2b2b3f51c
Sync from upstream TF. (#3461) 2026-02-12 22:18:36 +00:00
Esun Kim
399e48b8a9
[CI] Clean up bzl (#3478)
* Removed unused

* Unused
2026-02-12 14:05:54 -08:00
Esun Kim
5aa7a2e4b4
Format (#3477) 2026-02-12 13:49:57 -08:00
Esun Kim
257ca0f8d0
Removed //pythons from windows/bazel (#3476) 2026-02-12 13:36:39 -08:00
Esun Kim
5b1f1007d0
Simplfied (#3475) 2026-02-12 13:25:47 -08:00