Skip to content

Commit 5d944d1

Browse files
author
Thiago Crepaldi
committed
Updates
1 parent afa9892 commit 5d944d1

File tree

5 files changed

+171
-162
lines changed

5 files changed

+171
-162
lines changed

beginner_source/onnx/README.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ ONNX
66
https://pytorch.org/tutorials/onnx/intro_onnx.html
77

88
2. export_simple_model_to_onnx_tutorial.py
9-
Export a PyTorch model to ONNX
9+
Exporting a PyTorch model to ONNX
1010
https://pytorch.org/tutorials/beginner/onnx/export_simple_model_to_onnx_tutorial.html
1111

1212
3. onnx_registry_tutorial.py
13-
Introduction to ONNX
13+
Extending the ONNX Registry
1414
https://pytorch.org/tutorials/beginner/onnx/onnx_registry_tutorial.html

beginner_source/onnx/export_simple_model_to_onnx_tutorial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
22
"""
33
`Introduction to ONNX <intro_onnx.html>`_ ||
4-
**Export a PyTorch model to ONNX** ||
5-
`Introduction to ONNX Registry <onnx_registry_tutorial.html>`_
4+
**Exporting a PyTorch model to ONNX** ||
5+
`Extending the ONNX Registry <onnx_registry_tutorial.html>`_
66
77
Export a PyTorch model to ONNX
88
==============================
@@ -168,9 +168,9 @@ def to_numpy(tensor):
168168

169169
onnxruntime_outputs = ort_session.run(None, onnxruntime_input)
170170

171-
######################################################################
171+
####################################################################
172172
# 7. Compare the PyTorch results with the ones from the ONNX Runtime
173-
# -----------------------------------------------------------------
173+
# ------------------------------------------------------------------
174174
#
175175
# The best way to determine whether the exported model is looking good is through numerical evaluation
176176
# against PyTorch, which is our source of truth.

beginner_source/onnx/intro_onnx.py

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""
22
**Introduction to ONNX** ||
3-
`Export a PyTorch model to ONNX <export_simple_model_to_onnx_tutorial.html>`_ ||
4-
`Introduction to ONNX Registry <onnx_registry_tutorial.html>`_
3+
`Exporting a PyTorch model to ONNX <export_simple_model_to_onnx_tutorial.html>`_ ||
4+
`Extending the ONNX Registry <onnx_registry_tutorial.html>`_
55
66
Introduction to ONNX
77
====================
@@ -37,21 +37,33 @@
3737
3838
The ONNX exporter depends on extra Python packages:
3939
40-
- `ONNX <https://onnx.ai>`_
41-
- `ONNX Script <https://onnxscript.ai>`_
40+
- `ONNX <https://onnx.ai>`_ standard library
41+
- `ONNX Script <https://onnxscript.ai>`_ library that enables developers to author ONNX operators,
42+
functions and models using a subset of Python in an expressive, and yet simple fashion.
4243
4344
They can be installed through `pip <https://pypi.org/project/pip/>`_:
4445
45-
.. note::
46-
This tutorial leverages `onnxscript <https://github.com/microsoft/onnxscript#readme>`__
47-
to create custom ONNX operators. onnxscript is a Python library that allows users to
48-
create custom ONNX operators in Python. It is a prerequisite learning material for
49-
this tutorial. Please make sure you have read the onnxscript tutorial before proceeding.
50-
5146
.. code-block:: bash
5247
5348
pip install --upgrade onnx onnxscript
5449
50+
To validate the installation, run the following commands:
51+
52+
.. code-block:: python
53+
54+
import torch
55+
print(torch.__version__)
56+
57+
import onnxscript
58+
print(onnxscript.__version__)
59+
60+
from onnxscript import opset18 # opset 18 is the latest (and only) supported version for now
61+
62+
import onnxruntime
63+
print(onnxruntime.__version__)
64+
65+
Each `import` must succeed without any errors and the library versions must be printed out.
66+
5567
Further reading
5668
---------------
5769

0 commit comments

Comments
 (0)