OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

tf2onnx

tf2onnx is an open-source developer tool that converts TensorFlow 2.x, Keras, TensorFlow.js and TensorFlow Lite models into ONNX through a command-line interface or Python API.

Independent OpenViST project profile, based on linked sources.

tf2onnx — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use tf2onnx when a model in a supported TensorFlow-family format needs an ONNX export for subsequent ONNX-compatible tooling.

Who it is for

  • Machine-learning developers exporting supported TensorFlow-family models to ONNX.
  • Teams adding an ONNX export step to a model migration workflow.

Documented uses

  • Convert a TensorFlow SavedModel into an ONNX file.
  • Export checkpoint, GraphDef, TFLite or TensorFlow.js model inputs using their documented conversion options.
  • Select an ONNX opset for the generated graph.
Before you choose

Requirements & limits

The project is a public GitHub repository licensed under Apache-2.0. The README documents installation from PyPI or GitHub.

  • The default output opset is 15; opsets 14–18 are supported and tested, while 6–13 are not tested.
  • Checkpoint and GraphDef inputs require graph input and output names.
  • TensorFlow.js support is experimental, and not all models may convert correctly.
  • TensorFlow operations can exceed ONNX mappings, so inspect the supported-operation mapping for model-specific needs.
  • The README states that the project is seeking a new maintainer.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Convert a SavedModel to ONNX

Create an ONNX file from a TensorFlow SavedModel using the documented command-line workflow.

Before you start

  • Python 3.10–3.12 and TensorFlow 2.x; the project tests with TensorFlow 2.13 or later.
  • tf2onnx installed and a TensorFlow SavedModel directory.
  • ONNX 1.9 or later; tf2onnx installs or upgrades ONNX if needed.

Steps

  1. Install tf2onnx with the command below.

    Documented command
    pip install -U tf2onnx
  2. Run the command below, replacing the paths with the input directory and desired output filename.

    Documented command
    python -m tf2onnx.convert --saved-model tensorflow-model-path --output model.onnx
  3. If you need a different ONNX opset, add --opset and the selected version.

Expected outcome

The command writes an ONNX model file at the specified output path; the default opset is 15.

Guide limitations

  • The project supports and tests ONNX opsets 14–18; opsets 6–13 are not tested.
  • TensorFlow has operations that may not map successfully to ONNX; consult the supported-operation mapping and troubleshooting guide.
Source-based practical guide

Convert a TFLite model to ONNX

Export a TFLite model to an ONNX file using the documented CLI example.

Before you start

  • tf2onnx installed and a .tflite model file.
  • Python 3.10–3.12; the project supports TensorFlow 2.x.

Steps

  1. Install tf2onnx with the command below.

    Documented command
    pip install -U tf2onnx
  2. Run the command below, substituting the input model path and output filename.

    Documented command
    python -m tf2onnx.convert --opset 16 --tflite tflite-file --output model.onnx

Expected outcome

The command specifies an ONNX output file and opset 16.

Guide limitations

  • The project notes that TensorFlow operations can cause mapping issues during conversion.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
13 October 2026
Original website title
onnx/tensorflow-onnx · Official homepage title · retained in its source language