Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7a5b6e

Browse files
committed
documentation
1 parentdaf4402 commitc7a5b6e

File tree

13 files changed

+868
-3
lines changed

13 files changed

+868
-3
lines changed

‎_doc/api/docs.rst‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
validation.docs
2+
===============
3+
4+
make_euclidean
5+
++++++++++++++
6+
7+
..autofunction::onnx_array_api.validation.docs.make_euclidean

‎_doc/api/index.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ API
2222
tools
2323
profiling
2424
f8
25+
docs

‎_doc/api/light_api.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@ Var
2424

2525
..autoclass::onnx_array_api.light_api.Var
2626
:members:
27+
:inherited-members:
2728

2829
Vars
2930
====
3031

3132
..autoclass::onnx_array_api.light_api.Vars
3233
:members:
34+
:inherited-members:

‎_doc/conf.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,34 @@
114114
"https://data-apis.org/array-api/",
115115
("2022.12/API_specification/generated/array_api.{0}.html",1),
116116
),
117+
"ast":"https://docs.python.org/3/library/ast.html",
117118
"cProfile.Profile":"https://docs.python.org/3/library/profile.html#profile.Profile",
118119
"DOT":"https://graphviz.org/doc/info/lang.html",
120+
"inner API":"https://onnx.ai/onnx/intro/python.html",
119121
"JIT":"https://en.wikipedia.org/wiki/Just-in-time_compilation",
120122
"onnx":"https://onnx.ai/onnx/",
123+
"onnx.helper":"https://onnx.ai/onnx/api/helper.html",
121124
"ONNX":"https://onnx.ai/",
125+
"ONNX Operators":"https://onnx.ai/onnx/operators/",
122126
"onnxruntime":"https://onnxruntime.ai/",
127+
"onnxruntime-training":"https://onnxruntime.ai/docs/get-started/training-on-device.html",
123128
"numpy":"https://numpy.org/",
124129
"numba":"https://numba.pydata.org/",
125130
"onnx-array-api": ("https://sdpython.github.io/doc/onnx-array-api/dev/"),
131+
"onnxscript":"https://github.com/microsoft/onnxscript",
126132
"pyinstrument":"https://github.com/joerick/pyinstrument",
127133
"python":"https://www.python.org/",
134+
"pytorch":"https://pytorch.org/",
135+
"reverse Polish notation":"https://en.wikipedia.org/wiki/Reverse_Polish_notation",
128136
"scikit-learn":"https://scikit-learn.org/stable/",
129137
"scipy":"https://scipy.org/",
138+
"sklearn-onnx":"https://onnx.ai/sklearn-onnx/",
139+
"spox":"https://github.com/Quantco/spox",
130140
"sphinx-gallery":"https://github.com/sphinx-gallery/sphinx-gallery",
141+
"tensorflow":"https://www.tensorflow.org/",
142+
"tensorflow-onnx":"https://github.com/onnx/tensorflow-onnx",
131143
"torch":"https://pytorch.org/docs/stable/torch.html",
144+
"torch.onnx":"https://pytorch.org/docs/stable/onnx.html",
132145
#
133146
"C_OrtValue": (
134147
"http://www.xavierdupre.fr/app/onnxcustom/helpsphinx/"

‎_doc/tutorial/index.rst‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ Tutorial
66
..toctree::
77
:maxdepth:1
88

9-
overview
9+
onnx_api
10+
light_api
11+
numpy_api
1012
benchmarks

‎_doc/tutorial/light_api.rst‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
.. _l-light-api:
2+
3+
==========================================
4+
Light API for ONNX: everything in one line
5+
==========================================
6+
7+
It is inspired from the:epkg:`reverse Polish notation`.
8+
Following example implements the euclidean distance.
9+
This API tries to keep it simple and intuitive to short functions.
10+
11+
..runpython::
12+
:showcode:
13+
14+
import numpy as np
15+
from onnx_array_api.light_api import start
16+
from onnx_array_api.plotting.text_plot import onnx_simple_text_plot
17+
18+
model = (
19+
start()
20+
.vin("X")
21+
.vin("Y")
22+
.bring("X", "Y")
23+
.Sub()
24+
.rename("dxy")
25+
.cst(np.array([2], dtype=np.int64), "two")
26+
.bring("dxy", "two")
27+
.Pow()
28+
.ReduceSum()
29+
.rename("Z")
30+
.vout()
31+
.to_onnx()
32+
)
33+
34+
print(onnx_simple_text_plot(model))
35+
36+
There are two kinds of methods, the graph methods, playing with the graph structure,
37+
and the methods for operators starting with an upper letter.
38+
39+
Graph methods
40+
=============
41+
42+
Any graph must start with function:func:`start <onnx_array_api.light_api.start>`.
43+
It is usually following by `vin` to add an input.
44+
45+
* bring (:meth:`cst <onnx_array_api.light_api.Var.bring>`,:meth:`cst <onnx_array_api.light_api.Vars.bring>`):
46+
assembles multiple results into a set before calling an operator taking mulitple inputs,
47+
* cst (:meth:`cst <onnx_array_api.light_api.Var.cst>`,:meth:`cst <onnx_array_api.light_api.Vars.cst>`):
48+
adds a constant tensor to the graph,
49+
* rename (:meth:`cst <onnx_array_api.light_api.Var.rename>`,:meth:`cst <onnx_array_api.light_api.Vars.rename>`):
50+
renames or give a name to a variable in order to call it later.
51+
* vin (:meth:`cst <onnx_array_api.light_api.Var.vin>`,:meth:`cst <onnx_array_api.light_api.Vars.vin>`):
52+
adds an input to the graph,
53+
* vout (:meth:`cst <onnx_array_api.light_api.Var.vout>`,:meth:`cst <onnx_array_api.light_api.Vars.vout>`):
54+
declares an existing result as an output.
55+
56+
These methods are implemented in class:class:`onnx_array_api.light_api.var.BaseVar`
57+
58+
Operator methods
59+
================
60+
61+
They are described in:epkg:`ONNX Operators` and redefined in a stable API
62+
so that the definition should not change depending on this opset.
63+
:class:`onnx_array_api.light_api.Var` defines all operators taking only one input.
64+
:class:`onnx_array_api.light_api.Vars` defines all other operators.
65+
66+
Numpy methods
67+
=============
68+
69+
Numpy users expect methods such as `reshape`, property `shape` or
70+
operator `+` to be available as well and that the case. They are
71+
defined in class:class:`Var <onnx_array_api.light_api.Var>` or
72+
:class:`Vars <onnx_array_api.light_api.Vars>` depending on the number of
73+
inputs they require. Their name starts with a lower letter.

‎_doc/tutorial/overview.rst‎renamed to ‎_doc/tutorial/numpy_api.rst‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _l-numpy-api-onnx:
2+
13
==================
24
Numpy API for ONNX
35
==================

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp