Skip to content

feat(compression): implement model_editor for TFLite model manipulation#3575

Open
rkuester wants to merge 1 commit into
tensorflow:mainfrom
rkuester:feat-decode-submit
Open

feat(compression): implement model_editor for TFLite model manipulation#3575
rkuester wants to merge 1 commit into
tensorflow:mainfrom
rkuester:feat-decode-submit

Conversation

@rkuester
Copy link
Copy Markdown
Contributor

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

@rkuester rkuester requested a review from a team as a code owner May 26, 2026 21:18
@rkuester rkuester added ci:full Triggers the comprehensive cross-platform test suite. ci:ready Triggers the basic TFLM test suite. labels May 26, 2026
@rkuester rkuester temporarily deployed to integration-test May 26, 2026 21:23 — with GitHub Actions Inactive
@rkuester rkuester requested a review from veblush May 26, 2026 22:12
Comment thread tensorflow/lite/micro/compression/model_editor.py Outdated
Copy link
Copy Markdown
Collaborator

@veblush veblush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@veblush veblush self-requested a review May 28, 2026 21:57
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 tensorflow#3256
@rkuester rkuester force-pushed the feat-decode-submit branch from f537167 to 261c525 Compare May 28, 2026 22:42
@veblush veblush enabled auto-merge May 28, 2026 22:43
@rkuester rkuester deployed to integration-test May 28, 2026 22:43 — with GitHub Actions Active
@veblush veblush added this pull request to the merge queue May 28, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:full Triggers the comprehensive cross-platform test suite. ci:ready Triggers the basic TFLM test suite.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants