1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! # `onnx-runtime-ir`
//!
//! The Graph intermediate representation (IR) for the ORT 2.0 runtime.
//!
//! This crate is the **stable contract** that every downstream runtime crate
//! (`onnx-runtime-loader`, `onnx-runtime-ep-api`, `onnx-runtime-session`, …)
//! builds against. It is intentionally pure, safe Rust with no FFI and no
//! device dependencies so it compiles standalone on any target.
//!
//! It is a Rust port of the design captured in `docs/ORT2.md` §3 (Graph IR),
//! §5 (Striding & Layout) and §11 (Dynamic Shape), itself inspired by the
//! Python [`onnx-ir`](https://github.com/onnx/ir-py) package.
//!
//! ## What lives here
//!
//! | Concept | Type |
//! |---------|------|
//! | Element type | [`DataType`] |
//! | Symbolic / static shapes | [`Shape`], [`Dim`], [`SymbolConstraints`] |
//! | Physical strided layout | [`TensorLayout`], [`MemoryFormat`] |
//! | Device placement | [`DeviceType`], [`DeviceId`] |
//! | Graph values (SSA edges) | [`Value`], [`ValueId`] |
//! | Graph operations | [`Node`], [`NodeId`], [`Attribute`] |
//! | Constant / weight storage | [`TensorData`], [`SparseTensorData`], [`WeightRef`] |
//! | The graph itself | [`Graph`] |
//! | Errors | [`IrError`], [`GraphError`] |
//!
//! ## Design guarantees
//!
//! * **SSA-like:** every [`Value`] has at most one producer [`Node`]; node
//! outputs are unique.
//! * **First-class layout & device:** every value carries a [`TensorLayout`]
//! and an optional [`DeviceId`], unlike upstream ONNX / `onnx-ir`.
//! * **Mutable during optimization:** the [`Graph`] mutation API keeps
//! producer/consumer edges consistent so optimization passes can rewrite it,
//! then it is shared immutably via `Arc` once frozen.
//!
//! Deep algorithms whose full implementation belongs to a later task (e.g.
//! per-op shape inference) are represented here only by their data model; the
//! `Graph` operations that are cheap and foundational (topological ordering,
//! validation, edge rewiring, broadcasting, stride arithmetic) are fully
//! implemented and unit-tested so downstream crates compile against a stable,
//! working surface.
pub use ;
pub use ;
pub use DataType;
pub use ;
pub use Graph;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;