onnx-ir
Efficient in-memory representation for ONNX
Decision gist · record as of 2026-08-14
Yes. onnx-ir is actively maintained (released 2026-08-11), has no known vulnerabilities, carries a permissive Apache-2.0 license, and low install friction. It is worth installing if you need to programmatically construct, analyze, or transform ONNX graphs. The IR abstraction is most valuable for tooling and optimization workflows; for simple model inference, standard ONNX Runtime is more direct.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python >=3.9; onnx package must be installed as a runtime dependency.
- Installation is straightforward with low friction; the package has active maintenance (last commit 2026-08-10, released 2026-08-11) and requires only five runtime dependencies including numpy, onnx, typing_extensions, ml_dtypes, and sympy.
License · maintenance · safety
Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), so you can use, modify, and distribute onnx-ir freely in commercial and open-source projects with minimal restrictions.
last release 2026-08-11 (3 days) · last repo commit 2026-08-10 · 45 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,113,169 downloads/mo, #2,748 on PyPI
Alternatives
Verify before relying
pip install onnx-ir
import onnx_ir
from onnx_ir import Model
# Load and manipulate an ONNX model via the IR
model = Model.load('model.onnx')- Whether the IR can load and fix invalid ONNX models as claimed in the description.
- Performance characteristics and memory footprint compared to direct protobuf manipulation.
- Whether mmap'ed external tensors and zero-copy semantics are production-ready.
What it is and what it does
onnx-ir is an in-memory intermediate representation layer for ONNX models that decouples graph manipulation from protobuf serialization. It provides a Pythonic API for constructing, analyzing, and transforming ONNX computation graphs while supporting the full ONNX specification. The package is designed to handle large models efficiently through memory-mapped external tensors and unified interfaces for different tensor types (numpy arrays, PyTorch tensors, ONNX TensorProto), with no hard limits on tensor size and zero-copy semantics where possible.
The IR is built on core entities—Model, Graph, Node, Value—that map intuitively to ONNX protobuf concepts but remain independent of the serialization format once loaded. It supports robust mutation with concurrent iterators on the graph, making it suitable for workflows that need to inspect and modify model structure programmatically. The package targets developers building ONNX tooling, model optimization pipelines, or graph-level analysis tools.
Use it for
- Build ONNX models programmatically by constructing graphs through the IR API rather than working directly with protobuf.
- Analyze and traverse ONNX model topology to extract information about layers, connections, and data flow.
- Transform and optimize ONNX graphs by mutating nodes and values while iterating over the graph structure.
- Load and repair invalid ONNX models that cannot be loaded via standard protobuf deserialization.
- Integrate ONNX model manipulation into larger ML tooling pipelines without protobuf as a runtime dependency.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
onnx-ir is actively maintained (released 2026-08-11), has no known vulnerabilities, carries a permissive Apache-2.0 license, and low install friction. It is worth installing if you need to programmatically construct, analyze, or transform ONNX graphs. The IR abstraction is most valuable for tooling and optimization workflows; for simple model inference, standard ONNX Runtime is more direct.
Install
onnx-ir on PyPI
Before you install
Installation is straightforward with low friction; the package has active maintenance (last commit 2026-08-10, released 2026-08-11) and requires only five runtime dependencies including numpy, onnx, typing_extensions, ml_dtypes, and sympy.
Requires Python >=3.9; onnx package must be installed as a runtime dependency.
License in practice
Licensed under Apache-2.0 (permissive), so you can use, modify, and distribute onnx-ir freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install onnx-ir
import onnx_ir
from onnx_ir import Model
# Load and manipulate an ONNX model via the IR
model = Model.load('model.onnx')
Verify before relying
- Whether the IR can load and fix invalid ONNX models as claimed in the description.
- Performance characteristics and memory footprint compared to direct protobuf manipulation.
- Whether mmap'ed external tensors and zero-copy semantics are production-ready.
Package facts
| License | Apache-2.0 permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagesnumpyonnxtyping_extensionsml_dtypessympy |
| Maintenance | Actively maintained 3 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 3,113,169 / month, #2,748 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/Stable |
Evidence: onnx_ir-1.0.0-py3-none-any.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 graph manipulation”
- onnx-ironnx-ir provides an in-memory intermediate representation for ONNX…
- onnx-graphsurgeonONNX GraphSurgeon lets you programmatically create and modify ONNX…
- sna4onnxAdds new operations (nodes) to ONNX model graphs at specified…
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-graphsurgeon · onnxoptimizer · onnxscript · onnxsim · onnx-weekly · onnx · onnx-tool · pyvex · xdsl · vineyard