Skip to content

Commit 5b86e47

Browse files
authored
1 parent fc2e5da commit 5b86e47

File tree

5 files changed

+72
-5
lines changed

5 files changed

+72
-5
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ dmypy.json
100100
*.onnxlib
101101
**/onnx_backend_test_code/**
102102
docs/auto_examples/*
103+
docs/intermediate_representation/generated/*
103104
tests/export/*
104105
tests/models/testoutputs/*
105106
tests/mylib.onnxlib

docs/_templates/classtemplate.rst

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.. role:: hidden
2+
:class: hidden-section
3+
.. currentmodule:: {{ module }}
4+
5+
6+
{{ name | underline}}
7+
8+
.. autoclass:: {{ name }}
9+
:members:
10+
11+
12+
..
13+
autogenerated from docs/_templates/classtemplate.rst
14+
note it does not have :inherited-members:
+15
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
# ONNX IR
22

3+
An in-memory IR that supports the full ONNX spec, designed for graph construction, analysis and transformation.
4+
5+
## Features ✨
6+
7+
- Full ONNX spec support: all valid models representable by ONNX protobuf, and a subset of invalid models (so you can load and fix them).
8+
- Low memory footprint: mmap'ed external tensors; unified interface for ONNX TensorProto, Numpy arrays and PyTorch Tensors etc. No tensor size limitation. Zero copies.
9+
- Straightforward access patterns: Access value information and traverse the graph topology at ease.
10+
- Robust mutation: Create as many iterators as you like on the graph while mutating it.
11+
- Speed: Performant graph manipulation, serialization/deserialization to Protobuf.
12+
- Pythonic and familiar APIs: Classes define Pythonic apis and still map to ONNX protobuf concepts in an intuitive way.
13+
- No protobuf dependency: The IR does not require protobuf once the model is converted to the IR representation, decoupling from the serialization format.
14+
15+
## Get started
16+
317
```{toctree}
418
:maxdepth: 1
519
620
getting_started
721
tensors
822
ir_api
23+
generated
924
```
+41-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
11
# onnxscript.ir
22

3-
<!-- TODO: Organize the orders and add tutorial -->
3+
```{eval-rst}
4+
.. automodule::onnxscript.ir
5+
```
6+
7+
## IR objects
48

59
```{eval-rst}
6-
.. automodule:: onnxscript.ir
7-
:members:
8-
:undoc-members:
10+
.. currentmodule:: onnxscript
11+
.. autosummary::
12+
:toctree: generated
13+
:nosignatures:
14+
:template: classtemplate.rst
15+
16+
ir.Model
17+
ir.Graph
18+
ir.GraphView
19+
ir.Function
20+
ir.Node
21+
ir.Value
22+
ir.Attr
23+
ir.RefAttr
24+
ir.Shape
25+
ir.SymbolicDim
26+
ir.TypeAndShape
27+
ir.TensorType
28+
ir.SparseTensorType
29+
ir.SequenceType
30+
ir.OptionalType
31+
ir.Tensor
32+
ir.ExternalTensor
33+
ir.StringTensor
34+
```
35+
36+
## Enums
37+
38+
```{eval-rst}
39+
.. autosummary::
40+
:toctree: generated
41+
:nosignatures:
42+
:template: classtemplate.rst
43+
44+
ir.DataType
45+
ir.AttributeType
946
```

docs/intermediate_representation/tensors.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ The following example shows how to create a `FLOAT8E4M3FN` tensor, transform its
167167
print("tensor.numpy():", tensor.numpy()) # [0.00195312 0.00585938]
168168
169169
# Compute
170-
times_100 = tensor.numpy() * 100
170+
times_100 = tensor.numpy() * np.array(100, dtype=tensor.numpy().dtype)
171171
print("times_100:", times_100)
172172
173173
# Create a new tensor out of the new value; dtype must be specified

0 commit comments

Comments
 (0)