Skip to main content

A tool to legalize TFLite FlatBuffer to TOSA MLIR.

Project description

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.

Requirements

Before you build or run 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.9

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.9
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.

Usage

Python API

from tosa_converter_for_tflite import tflite_flatbuffer_to_tosa_mlir, TosaConverterOutputFormat

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

# textual MLIR output
tflite_flatbuffer_to_tosa_mlir(
    "model_input.tflite",
    "model_output.mlir",
    TosaConverterOutputFormat.Text
)

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: 2025.07.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

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

Supported Platforms

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

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tosa_converter_for_tflite-2025.11.0-cp313-cp313-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.13Windows x86-64

tosa_converter_for_tflite-2025.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (25.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_converter_for_tflite-2025.11.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (26.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_converter_for_tflite-2025.11.0-cp312-cp312-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.12Windows x86-64

tosa_converter_for_tflite-2025.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (25.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_converter_for_tflite-2025.11.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (26.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_converter_for_tflite-2025.11.0-cp311-cp311-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.11Windows x86-64

tosa_converter_for_tflite-2025.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (25.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_converter_for_tflite-2025.11.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (26.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_converter_for_tflite-2025.11.0-cp310-cp310-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.10Windows x86-64

tosa_converter_for_tflite-2025.11.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (25.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_converter_for_tflite-2025.11.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (26.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

tosa_converter_for_tflite-2025.11.0-cp39-cp39-win_amd64.whl (9.2 MB view details)

Uploaded CPython 3.9Windows x86-64

tosa_converter_for_tflite-2025.11.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (25.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

tosa_converter_for_tflite-2025.11.0-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (26.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 3b8856b677c16db5a27172de486f83afef24ec450d56d4cc7fe08cc44ad1df9a
MD5 1f3f5a6f9e8cf8f8c8f3c3d61852b001
BLAKE2b-256 3095109ffac9cbaa86963c429a3ebcb51d04f2e34f0a444b2d84caa750e78a58

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f3cf7b769244474f73fb8664979435f6e80b7416d71c6ec853b0f31b126c066e
MD5 cb1994a9cbc3723faab13c9e6d0103cd
BLAKE2b-256 3cd794f5c10568c25fc4d52bccacbc996bd721daaea4d3f1295da1c7433ea60a

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 cd2fecb4d9db57f2d2af8a2ac62cfbdc7c9d13e10f9ed87bd43b9d149639a25a
MD5 f2b7287eb31c510e804b6532697e9217
BLAKE2b-256 840a63ac726ed1ea422faacd67c3a8391c7aceccce433f17367029939ecc099f

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 84dad4d16b3b6b651806ee8cbe881483c05cb2ddcf7c44d8f26f2dc3eb308399
MD5 17cf209286458fa5c4bb742799709b4a
BLAKE2b-256 a62d9f73e4e3e76e3ad494f72e3556b6a0c4f0e0bd641beae9c1234ac62a581e

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 611b35434b429943d486d4fcf3b467b9c1add8f0f9c53d2810d6a163f11e79a8
MD5 6f6719e81552a968f9402f8166b851e5
BLAKE2b-256 368b682c061640df24e68f9b0626ecbfd7c7c5b4268c08514f6b24fcd3dcfff0

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 bde66d38d583f6b6bb2c3ef43d2ebdee815e4af91b49d3884067e494891eea2e
MD5 4487812f6e3407d947e841d96d69d78f
BLAKE2b-256 0a8cbfd6a8c8ac796cdff183bf852a8fcad2dbdc8ad81f7119fc7671e21c2fdb

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 8594d39409abf73ac3118762a67627fac0431e4fb4cd6e482410440415114265
MD5 4ff5f652e71d1f13d4777f29ce25ae88
BLAKE2b-256 9340ff83b616de98f0e5cd53683d707233bbfce6aefd0e9b69d0e393a0d1d294

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f944b146f680ef0bfeeb2f3959460cd723f10b273056a3605c8d8ac757db021d
MD5 a98b31e192b7afc18b404bb1c9a8ddba
BLAKE2b-256 ee593f0e137198b56964505f4a119932d5461871714d5ee76d0a195f16e01a49

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 00de17cedbb8b044d21a6c152a18467c1c38be9ab7a3e79fe44745ce7ce9b2b8
MD5 b34bad43ed0d09c9293e8b3a0967ff96
BLAKE2b-256 230dcf0aa15317b0574a02cb8213380d65836e6db1362bc9419edbe87f1472e1

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7b93c252dff4e2deb96f56aa12c6b3bfba34f963b54581bcf9a8608289aba0d0
MD5 c4a16c37d592377b1c34fadce155777e
BLAKE2b-256 2809bc239602d6312ef2532471fd95883aa4a46e10d7a18d320f6e63e707b0b3

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c187e1034c310f6106af9fe76c353770f8a5a23fd58702e9fd6b8335deee327f
MD5 2f69592cad449388238cfdb2ea288569
BLAKE2b-256 b60a48fd27eb8d7e27b43e33beedd36f826d50eded90e0291d1224e2d0e39b78

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b662ed2b43be53f5d87bcf7ae9f27146bee36ea84f5e9bead6b652390a77937f
MD5 aea8017a7f4c00440f1dbf58cd503e15
BLAKE2b-256 fa5e4e50f4ba64a07f556021f65ec4801a086f7cb4f448760ef7baf39214e617

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e3265149f9e299155543c33986af6acae934c5970bc3dc9ecf69a30d36bb612f
MD5 4e006c8ebb45f41e4a4d575c241eecdb
BLAKE2b-256 bc267a7e1faceb8e453df61e9ea98b1cbccdb61ef26cdc96451ef3d861e55bdf

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f7ab7619c15094ec014c6a43bd7d109268e86677e7d5c759931962ca1a508cfa
MD5 1691dd09c5b4dd737649d198856b9e82
BLAKE2b-256 285d7b62bce373e7738b7e9757441ddb21e7918f8a01050f7f3ab0b7701072ea

See more details on using hashes here.

File details

Details for the file tosa_converter_for_tflite-2025.11.0-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tosa_converter_for_tflite-2025.11.0-cp39-cp39-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 a23654fd9826084c4f016ead67b9bb3193dfbaed580734f9ab672605b33e2ce9
MD5 d6aa96fbba38566e35e58a061e66d512
BLAKE2b-256 f16c8259ccf53b64af45ad7d5bf537fe651c664f74320135dfac0bd16609281f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page