File: index.md

package info (click to toggle)
onnx 1.20.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 62,536 kB
  • sloc: python: 77,643; cpp: 60,445; sh: 52; makefile: 50; javascript: 1
file content (72 lines) | stat: -rw-r--r-- 1,883 bytes parent folder | download
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
72
(l-python-onnx-api)=

# API Reference

```{tip}
The [ir-py project](https://github.com/onnx/ir-py) provides alternative Pythonic APIs for creating and manipulating ONNX models without interaction with Protobuf.
```

## Versioning

The following example shows how to retrieve onnx version,
the onnx opset, the IR version. Every new major release increments the opset version
(see {ref}`l-api-opset-version`).

```{eval-rst}
.. exec_code::

    from onnx import __version__, IR_VERSION
    from onnx.defs import onnx_opset_version
    print(f"onnx.__version__={__version__!r}, opset={onnx_opset_version()}, IR_VERSION={IR_VERSION}")
```

The intermediate representation (IR) specification is the abstract model for
graphs and operators and the concrete format that represents them.
Adding a structure, modifying one them increases the IR version.

The opset version increases when an operator is added or removed or modified.
A higher opset means a longer list of operators and more options to
implement an ONNX functions. An operator is usually modified because it
supports more input and output type, or an attribute becomes an input.

## Data Structures

Every ONNX object is defined based on a [protobuf message](https://googleapis.dev/python/protobuf/latest/google/protobuf/message.html)
and has a name ended with suffix `Proto`. For example, {ref}`l-nodeproto` defines
an operator, {ref}`l-tensorproto` defines a tensor. Next page lists all of them.

```{toctree}
:maxdepth: 1

classes
serialization
```

## Functions

An ONNX model can be directly from the classes described
in previous section but it is faster to create and
verify a model with the following helpers.

```{toctree}
:maxdepth: 1

backend
checker
compose
defs
external_data_helper
helper
hub
inliner
mapping
model_container
numpy_helper
parser
printer
reference
shape_inference
tools
utils
version_converter
```