onnx/optimizer

ONNX Optimizer

What it solves

ONNX Optimizer streamlines machine learning models by removing unnecessary operations and simplifying graph structures. It focuses on optimizations that can be performed using only the model's structure, ensuring the model remains efficient and clean without needing to know which specific hardware or runtime will eventually run it.

How it works

It processes ONNX models by applying a series of "passes"—specific transformation rules—to the model's graph. Users can select a custom list of these passes or use a default set of fusion and elimination operations. The tool can run these passes in a specific order, and it supports a "fixed-point" mode that repeatedly applies transformations until no further improvements can be made to the graph.

Who it’s for

This tool is designed for developers and researchers working with ONNX models who need to optimize their model graphs before deployment. It is particularly useful for those who want a backend-independent way to clean up models, whether they are using Python, C++, or C interfaces.

Highlights

  • Provides reusable, backend-independent optimization passes.
  • Includes both a Python API and a command-line interface for easy integration.
  • Supports custom pass selection and ordered execution.
  • Offers a fixed-point mode for iterative graph refinement.
  • Built with a high-performance C++ core for efficient processing.

Related

  • Project
  • Project
  • Project