Skip to content

onnx/ir-py

ONNX IR

PyPI - Version PyPI - Python Version Ruff codecov DeepWiki 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.

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.

Packages

No packages published

Contributors 18

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy