Skip to main content

TOSA converter for TFLite

A tool to legalize TFLite FlatBuffer to TOSA MLIR Bytecode or Text.

TOSA Converter for TFLite is currently in the experimental development phase. As such, it may contain bugs or incomplete features. We appreciate your feedback and patience as we continue to improve the tool.

Usage

Python API

from tosa_converter_for_tflite import (
    tflite_flatbuffer_to_tosa_mlir,
    TosaConverterDebugInfo,
    TosaConverterOutputFormat,
)

# default (bytecode) output
tflite_flatbuffer_to_tosa_mlir("model_input.tflite", "model_output.tosa.mlirbc")

# textual MLIR output (locations are off by default)
tflite_flatbuffer_to_tosa_mlir(
    "model_input.tflite",
    "model_output.mlir",
    TosaConverterOutputFormat.Text
)

# textual MLIR output with explicit location annotations (debug info)
tflite_flatbuffer_to_tosa_mlir(
    "model_input.tflite",
    "model_output_with_locs.mlir",
    TosaConverterOutputFormat.Text,
    TosaConverterDebugInfo.Enable
)

Command-line Interface (CLI)

The tosa-converter-for-tflite CLI provides a simple way to convert .tflite models into TOSA MLIR(bytecode or text). It supports both file-based and stream-based workflows for easy integration into toolchains or pipelines.

Usage Examples

Convert a .tflite file to a TOSA bytecode file(default):

tosa-converter-for-tflite model.tflite --bytecode -o out.tosa.mlirbc

Version Info

--version prints the converter version along with the TensorFlow and LLVM commit hashes:

TOSA Converter for TFLite version: 2026.02.0
TensorFlow commit: <tf_commit_hash>
LLVM commit:       <llvm_commit_hash>

Read the model from file and write textual TOSA MLIR to file

tosa-converter-for-tflite model.tflite --text -o out.mlir

Enable per-operation location annotations in textual MLIR

tosa-converter-for-tflite model.tflite --text --emit-debug-info -o out_with_locs.mlir

Read the model from a file and write textual TOSA MLIR to stdout

tosa-converter-for-tflite model.tflite --text

Stream the model from stdin and write bytecode to file

cat model.tflite | tosa-converter-for-tflite --bytecode -o out.tosa.mlirbc

Fully stream the model from stdin and write textual MLIR to stdout

cat model.tflite | tosa-converter-for-tflite --text

Debug info and locations

Textual MLIR can include per-operation location annotations (e.g., loc(#loc3)). These annotations are disabled by default; enable them with TosaConverterDebugInfo.Enable in the Python API or --emit-debug-info in the CLI. They are useful for debugging, but can significantly increase output size. If you run into memory or storage issues, keep debug info disabled.

When writing to an in-memory Python BinaryIO stream, the converter buffers the entire output before writing it to the stream. For large models (especially with debug info enabled), prefer writing to a file to avoid excessive peak memory use.

Supported Platforms

This tool supports Linux(r) and Windows(r) on x86_64 architectures. Support for Linux(r) on AArch64 is experimental.

Build Requirements

Before you build the converter, ensure you have the following tools installed and on your PATH.

Linux (Ubuntu)

Tool Purpose Version
Bazel build v7.4.1
Clang build >= v17
Python build & runtime >= v3.10

Windows (x86_64)

Tool Purpose Version
Bazel build 7.4.1
LLVM (Clang-CL) build 20.1.0
MSYS2 shell & tooling 3.6.3-2 with Pacman 20.1.0 and bash.exe
Python build & runtime ≥3.10
Visual Studio 2022 Professional (C++ Desktop Dev Tools) build & debug 17.11.5

Python wheel creation

To build the Python wheel Clang is required, the wheel can then be built using:

pip install build
python -m build --wheel

The wheel should now be in the dist directory.

Versioning

This project uses Calendar Versioning (CalVer) in the format: YYYY.0M.Micro[.Modifier]

  • YYYY – 4-digit release year (e.g., 2025)
  • 0M – 2-digit Zero-padded release month (e.g., 07 for July)
  • Micro – The third and usually final number in the version. Sometimes referred to as the "patch" segment.
  • Modifier - Optional text tag used to signify extra information about the build. Currently accepted options values:
    • .dev0 - (default) Any build produced with default configuration will have this tag.
    • no tag (empty string) - builds produced for release will have no tag at all.

License

TOSA Converter for TFLite is distributed under the Apache 2.0 License.

Note: the code under tosa_converter_for_tflite/tfl_passes was migrated over from the TensorFlow project and therefore inherits copyright attributed to The TensorFlow Authors and Google Inc. This code is also distributed under the Apache 2.0 License.

Trademarks and Copyrights

  • Bazel(tm) is a trademark of Google(r) LLC.
  • Git(tm) is a trademark of Software Freedom Conservancy.
  • LLVM(r) and the LLVM logo are trademarks of the LLVM Foundation.
  • Linux(r) is the registered trademark of Linus Torvalds in the U.S. and elsewhere.
  • Python(r) is a registered trademark of the Python Software Foundation.
  • TensorFlow(tm), the TensorFlow logo and any related marks are trademarks of Google Inc.
  • Ubuntu(r) is a registered trademark of Canonical(r) Ltd.
  • Visual Studio(r) is a registered trademark of Microsoft(r) Corporation.
  • Windows(r) is a registered trademark of Microsoft(r) Corporation.
  • CUDA(tm) is a registered trademark of NVIDIA(r) Corporation

Metadata

Release files for tosa-converter-for-tflite 2026.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for tosa-converter-for-tflite 2026.2.0
File
tosa_converter_for_tflite-2026.2.0-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
tosa_converter_for_tflite-2026.2.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64, Linux glibc 2.27+ x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
tosa_converter_for_tflite-2026.2.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details
tosa_converter_for_tflite-2026.2.0-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details
tosa_converter_for_tflite-2026.2.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details

Total release size: 245.1 MB

Release files / tosa_converter_for_tflite-2026.2.0-cp313-cp313-win_amd64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp313-cp313-win_amd64.whl
Size 9.2 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
b6d2d76744e4bed6845ff7ed61636ff0839d89a9ad547532140c3a047f5adb8d
BLAKE2b-256 checksum
How to use checksums
c248acad200d735745f5527f6e7d8f726529a240b21d145ccf1e0e70e9b5041e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 25.5 MB
Tags CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
dc3b52a9aefdf359aef631eed20669e178c0c89a706df5fa675ba5252ecd0591
BLAKE2b-256 checksum
How to use checksums
1f0e2d0d632cff8ac155d43a1a8a5e8011bd03d65dd994638aed6b8319b62af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 26.6 MB
Tags CPython 3.13 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
241fb6950ef5fea36e5cbb0da8f0eefdb3209a857c9b59d9344b427c7609e730
BLAKE2b-256 checksum
How to use checksums
83fe47a342c1657e453918c119aa31b321373ce12d3ae2a2101ca07554056523
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / tosa_converter_for_tflite-2026.2.0-cp312-cp312-win_amd64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp312-cp312-win_amd64.whl
Size 9.2 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
019b3213394c4c59a21463e69bd2f7183f7e65e424ec489683ba0fa071172af1
BLAKE2b-256 checksum
How to use checksums
22e0c0872bfd1881c17d3967e25b25be1e7370e6080d682a93ee8dceb82b0dbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 25.5 MB
Tags CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
135303f11cd8995b20f29a7cb390a9acb6d393390769cb5e3a8bc2198ab31fde
BLAKE2b-256 checksum
How to use checksums
8328e2969ab1fb65bb706abe040eea75563fddfa3cba6fcfe02af1c57b40472c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 26.6 MB
Tags CPython 3.12 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
0995dc905dd9e546aa5a64dd264b68f29542ce57391ceabde1e36f7acf5376f2
BLAKE2b-256 checksum
How to use checksums
279f5bb9c3c4d4b2d6ad0506786d18cd52c0b047f694e91d501b0519f009ae98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / tosa_converter_for_tflite-2026.2.0-cp311-cp311-win_amd64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp311-cp311-win_amd64.whl
Size 9.2 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
dcf58f30ce6f467fbe5fa9dbf2ac914b857cdf25774e707d68d1f681cccce457
BLAKE2b-256 checksum
How to use checksums
87022fa7b835c516756fdf2abf19e02ccd688be7ed89180a02c4e917dd1cc4d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 25.5 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
149c24df7bc89e0ada928107114d83228efe0f075156078492a598e5c9483150
BLAKE2b-256 checksum
How to use checksums
5589d6eec09b6f77819344df909eed0de72c7a28b176554754f03b8f73298faa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 26.6 MB
Tags CPython 3.11 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
30ef9439cf391bda1fb25d950044497ae3616e9733e071683e7b2619c9c249f2
BLAKE2b-256 checksum
How to use checksums
e4d92169cefa1240817b4f67ea2a0393961add0ad94c5768a8e3041a829828b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / tosa_converter_for_tflite-2026.2.0-cp310-cp310-win_amd64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp310-cp310-win_amd64.whl
Size 9.2 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
225a7b9827adb69e6eea1378d4b2db661f423b07c5be5de4789e79a1d342d500
BLAKE2b-256 checksum
How to use checksums
67630df711a0fd03b1b3fb76ff2cd71519faba9ae91aeb9d63574cc6141d166e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 25.5 MB
Tags CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
a2cd86305d96904fd95dd1e50b59efeb6969c1349db4adac0a569c7e274c2f3f
BLAKE2b-256 checksum
How to use checksums
a7d21243fc77c7f1e2cea22a0df13b95a46355358ff4eb33e20a060f6e5e72b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.19

Release files / tosa_converter_for_tflite-2026.2.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL tosa_converter_for_tflite-2026.2.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 26.6 MB
Tags CPython 3.10 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64
SHA-256 checksum
How to use checksums
a9d5d25d811f93ae80ca1bbcdb1935d8bd77fcdd7f1febce87161c706e7ff363
BLAKE2b-256 checksum
How to use checksums
4272ef28d5ba17acceaf10695809597ace9ab358733b8a8f1f08251f5f0aa387
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

2026.2.0 This release

12 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page