onnxoptimizer
ONNX Optimizer
Decision gist · record as of 2026-08-14
Yes, if you work with ONNX models and want to reduce inference cost. The package is actively maintained, has no known vulnerabilities, uses a permissive license, and offers both a Python API and command-line interface. Install friction is moderate due to compiled wheels, but prebuilt binaries for current Python versions mitigate that. Suitable for model optimization pipelines in production or research.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; onnx must be installed as a runtime dependency.
- Medium install friction due to compiled wheels; prebuilt binaries available for current Python versions on macOS, Linux, and Windows.
- Actively maintained with recent releases and no known vulnerabilities.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), allowing commercial use, modification, and redistribution with minimal restrictions.
last release 2026-01-07 (219 days) · last repo commit 2026-08-02 · 826 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 413,130 downloads/mo, #6,843 on PyPI
Alternatives
Verify before relying
pip install onnxoptimizer
import onnx
import onnxoptimizer
model = onnx.load('model.onnx')
optimized = onnxoptimizer.optimize(model)
onnx.save(optimized, 'optimized_model.onnx')- Which specific optimization passes are included in the prepackaged set beyond fusion and elimination.
- Performance impact (latency/throughput gains) from applying these optimizations on typical models.
- Whether custom optimization passes can be implemented and registered by users.
What it is and what it does
ONNX Optimizer is a C++ library with Python bindings that applies graph-level transformations to ONNX neural network models. It provides a set of prepackaged optimization passes—such as operator fusion and constant elimination—designed to be reusable across different ONNX backend implementations. The library aims to reduce duplication of optimization work by centralizing common transformations that can be expressed at the graph level without backend-specific knowledge.
You use it by loading an ONNX model, calling the optimizer with your chosen passes (or letting it apply the default fuse-and-elimination set), and saving the result. It also exposes a command-line interface for batch optimization. The package depends only on onnx and targets modern Python versions, with prebuilt wheels for common platforms.
Use it for
- Reduce model size and inference latency by fusing adjacent operators into single kernels before deployment.
- Apply constant folding to precompute static subgraphs and eliminate redundant computations at runtime.
- Standardize model optimization across multiple ONNX backend implementations without reimplementing passes.
- Batch-optimize a collection of ONNX models via command-line without writing Python scripts.
- Prepare models for edge deployment by applying graph-level optimizations before quantization or pruning.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you work with ONNX models and want to reduce inference cost.
The package is actively maintained, has no known vulnerabilities, uses a permissive license, and offers both a Python API and command-line interface. Install friction is moderate due to compiled wheels, but prebuilt binaries for current Python versions mitigate that. Suitable for model optimization pipelines in production or research.
Install
onnxoptimizer on PyPI
Before you install
Medium install friction due to compiled wheels; prebuilt binaries available for current Python versions on macOS, Linux, and Windows. Actively maintained with recent releases and no known vulnerabilities.
Requires Python 3.10 or later; onnx must be installed as a runtime dependency.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial use, modification, and redistribution with minimal restrictions.
Quickstart
pip install onnxoptimizer
import onnx
import onnxoptimizer
model = onnx.load('model.onnx')
optimized = onnxoptimizer.optimize(model)
onnx.save(optimized, 'optimized_model.onnx')
Verify before relying
- Which specific optimization passes are included in the prepackaged set beyond fusion and elimination.
- Performance impact (latency/throughput gains) from applying these optimizations on typical models.
- Whether custom optimization passes can be implemented and registered by users.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packageonnx |
| Maintenance | Actively maintained 219 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 413,130 / month, #6,843 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: onnxoptimizer-0.4.2-cp310-cp310-macosx_10_15_universal2.whl; onnxoptimizer-0.4.2-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; onnxoptimizer-0.4.2-cp310-cp310-win_amd64.whl; onnxoptimizer-0.4.2-cp311-cp311-macosx_10_15_universal2.whl; onnxoptimizer-0.4.2-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; onnxoptimizer-0.4.2-cp311-cp311-win_amd64.whl; onnxoptimizer-0.4.2-cp312-abi3-macosx_10_15_universal2.whl; onnxoptimizer-0.4.2-cp312-abi3-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl; onnxoptimizer-0.4.2-cp312-abi3-win_amd64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “onnx model optimization”
- onnxoptimizerApplies graph-level optimizations to ONNX models, including a library…
- spo4onnxApplies specialized optimization techniques to ONNX neural network…
- onnxslimOnnxSlim reduces the size and operator count of ONNX models while…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also onnx-tool · onnxsim · onnxscript · spo4onnx · scs4onnx · onnx-weekly · onnx-ir · onnxslim · optimum-onnx · nevergrad