Skip to main content

ONNX IR

PyPI - Version Ruff codecov PyPI Downloads

An in-memory IR that supports the full ONNX spec, designed for graph construction, analysis and transformation.

Getting Started

onnx-ir documentation

Installation

Via pip:

pip install onnx-ir

Or from source:

pip install git+https://github.com/onnx/ir-py.git

Features ✨

  • Full ONNX spec support: all valid models representable by ONNX protobuf, and a subset of invalid models (so you can load and fix them).
  • Low memory footprint: mmap'ed external tensors; unified interface for ONNX TensorProto, Numpy arrays and PyTorch Tensors etc. No tensor size limitation. Zero copies.
  • Straightforward access patterns: Access value information and traverse the graph topology at ease.
  • Robust mutation: Create as many iterators as you like on the graph while mutating it.
  • Speed: Performant graph manipulation, serialization/deserialization to Protobuf.
  • Pythonic and familiar APIs: Classes define Pythonic apis and still map to ONNX protobuf concepts in an intuitive way.
  • No protobuf dependency: The IR does not require protobuf once the model is converted to the IR representation, decoupling from the serialization format.

Concept Diagram

Concept Diagram

Code Organization 🗺️

  • _protocols.py: Interfaces defined for all entities in the IR.
  • _core.py: Implementation of the core entities in the IR, including Model, Graph, Node, Value, and others.
  • _enums.py: Definition of the type enums that correspond to the DataType and AttributeType in onnx.proto.
  • _name_authority.py: The authority for giving names to entities in the graph, used internally.
  • _linked_list.py: The data structure as the node container in the graph that supports robust iteration and mutation. Internal.
  • _metadata.py: Metadata store for all entities in the IR.

Download files

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

Source Distribution

onnx_ir-1.0.0.tar.gz (163.1 kB view details)

Uploaded Source

Built Distribution

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

onnx_ir-1.0.0-py3-none-any.whl (185.8 kB view details)

Uploaded Python 3

File details

Details for the file onnx_ir-1.0.0.tar.gz.

File metadata

  • Download URL: onnx_ir-1.0.0.tar.gz
  • Upload date:
  • Size: 163.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for onnx_ir-1.0.0.tar.gz
Algorithm Hash digest
SHA256 9e261f25fde8da9612ae5cb43b3b374d5ff469c04af0363cad588b2bb000b812
MD5 02788efbc576299a38d0268b224ab358
BLAKE2b-256 d6c261194cec0dbc5622273c0ebd592d37cc1dca0d7f1a744f02edd45ac905a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnx_ir-1.0.0.tar.gz:

Publisher: main.yml on onnx/ir-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file onnx_ir-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: onnx_ir-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 185.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for onnx_ir-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e578f0d608d3062866b48223616eb2d10a6d6d01f8b8faac596129034f483cc7
MD5 3710656b36e6702e7290b7a0e5f37f0d
BLAKE2b-256 91cd6d1637172eb59c7b18ac90ed089d1f599a11fe0e63b4db2d017f3bb38a32

See more details on using hashes here.

Provenance

The following attestation bundles were made for onnx_ir-1.0.0-py3-none-any.whl:

Publisher: main.yml on onnx/ir-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Supported by

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