- Notifications
You must be signed in to change notification settings - Fork0
First documentation of the light API#44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
9 commits Select commitHold shift + click to select a range
c7a5b6e documentation
xadupre897cc82 remove rstcheck, too many bugs
xadupre6c6c59e add missing link
xadupre8899900 fix unit test
xadupre00844cc fix documentation
xadupre7e5eb6c unstable
xadupre354f23a windows
xadupre16e697e update titles
xadupre20bbedd minorchanges
xadupreFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
27 changes: 0 additions & 27 deletions.github/workflows/rstcheck.yml
This file was deleted.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
2 changes: 1 addition & 1 deletionCHANGELOGS.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
31 changes: 29 additions & 2 deletionsREADME.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions_doc/api/docs.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| validation.docs | ||
| =============== | ||
| make_euclidean | ||
| ++++++++++++++ | ||
| .. autofunction:: onnx_array_api.validation.docs.make_euclidean |
1 change: 1 addition & 0 deletions_doc/api/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -22,3 +22,4 @@ API | ||
| tools | ||
| profiling | ||
| f8 | ||
| docs | ||
2 changes: 2 additions & 0 deletions_doc/api/light_api.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions_doc/conf.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
41 changes: 35 additions & 6 deletions_doc/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions_doc/tech/aapi.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion_doc/tutorial/index.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -6,5 +6,7 @@ Tutorial | ||
| .. toctree:: | ||
| :maxdepth: 1 | ||
| onnx_api | ||
| light_api | ||
| numpy_api | ||
| benchmarks | ||
78 changes: 78 additions & 0 deletions_doc/tutorial/light_api.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| .. _l-light-api: | ||
| ========================================== | ||
| Light API for ONNX: everything in one line | ||
| ========================================== | ||
| It is inspired from the :epkg:`reverse Polish notation`. | ||
| Following example implements the euclidean distance. | ||
| This API tries to keep it simple and intuitive to short functions. | ||
| .. runpython:: | ||
| :showcode: | ||
| import numpy as np | ||
| from onnx_array_api.light_api import start | ||
| from onnx_array_api.plotting.text_plot import onnx_simple_text_plot | ||
| model = ( | ||
| start() | ||
| .vin("X") | ||
| .vin("Y") | ||
| .bring("X", "Y") | ||
| .Sub() | ||
| .rename("dxy") | ||
| .cst(np.array([2], dtype=np.int64), "two") | ||
| .bring("dxy", "two") | ||
| .Pow() | ||
| .ReduceSum() | ||
| .rename("Z") | ||
| .vout() | ||
| .to_onnx() | ||
| ) | ||
| print(onnx_simple_text_plot(model)) | ||
| There are two kinds of methods, the graph methods, playing with the graph structure, | ||
| and the methods for operators starting with an upper letter. | ||
| Graph methods | ||
| ============= | ||
| Any graph must start with function :func:`start <onnx_array_api.light_api.start>`. | ||
| It is usually following by `vin` to add an input. | ||
| * bring (:meth:`Var.bring <onnx_array_api.light_api.Var.bring>`, | ||
| :meth:`Vars.bring <onnx_array_api.light_api.Vars.bring>`): | ||
| assembles multiple results into a set before calling an operator taking mulitple inputs, | ||
| * cst (:meth:`Var.cst <onnx_array_api.light_api.Var.cst>`, | ||
| :meth:`Vars.cst <onnx_array_api.light_api.Vars.cst>`): | ||
| adds a constant tensor to the graph, | ||
| * rename (:meth:`Var.rename <onnx_array_api.light_api.Var.rename>`, | ||
| :meth:`Vars.rename <onnx_array_api.light_api.Vars.rename>`): | ||
| renames or give a name to a variable in order to call it later. | ||
| * vin (:meth:`Var.vin <onnx_array_api.light_api.Var.vin>`, | ||
| :meth:`Vars.vin <onnx_array_api.light_api.Vars.vin>`): | ||
| adds an input to the graph, | ||
| * vout (:meth:`Var.vout <onnx_array_api.light_api.Var.vout>`, | ||
| :meth:`Vars.vout <onnx_array_api.light_api.Vars.vout>`): | ||
| declares an existing result as an output. | ||
| These methods are implemented in class :class:`onnx_array_api.light_api.var.BaseVar` | ||
| Operator methods | ||
| ================ | ||
| They are described in :epkg:`ONNX Operators` and redefined in a stable API | ||
| so that the definition should not change depending on this opset. | ||
| :class:`onnx_array_api.light_api.Var` defines all operators taking only one input. | ||
| :class:`onnx_array_api.light_api.Vars` defines all other operators. | ||
| Numpy methods | ||
| ============= | ||
| Numpy users expect methods such as `reshape`, property `shape` or | ||
| operator `+` to be available as well and that the case. They are | ||
| defined in class :class:`Var <onnx_array_api.light_api.Var>` or | ||
| :class:`Vars <onnx_array_api.light_api.Vars>` depending on the number of | ||
| inputs they require. Their name starts with a lower letter. |
4 changes: 4 additions & 0 deletions_doc/tutorial/overview.rst → _doc/tutorial/numpy_api.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.