:orphan: Example Gallery =============== .. raw:: html <div class="sphx-glr-thumbnails"> .. thumbnail-parent-div-open .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="The example below shows how we can define Selu as a function in onnxscript."> .. only:: html .. image:: /auto_examples/images/thumb/sphx_glr_01_plot_selu_thumb.png :alt: :ref:`sphx_glr_auto_examples_01_plot_selu.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Generating a FunctionProto</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="This example demonstrates the use of onnxscript to define an ONNX model. onnxscript behaves like a compiler. It converts a script into an ONNX model."> .. only:: html .. image:: /auto_examples/images/thumb/sphx_glr_02_plot_square_loss_thumb.png :alt: :ref:`sphx_glr_auto_examples_02_plot_square_loss.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Generating a ModelProto</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="The examples below show how we can define a library consisting of multiple functions, and export it."> .. only:: html .. image:: /auto_examples/images/thumb/sphx_glr_03_export_lib_thumb.png :alt: :ref:`sphx_glr_auto_examples_03_export_lib.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Generating a LibProto</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="An onnxscript function can be executed directly as a Python function (for example, with a Python debugger). This is useful for debugging an onnxscript function definition. This execution makes use of a backend implementation of the ONNX ops used in the function definition. Currently, the backend implementation uses onnxruntime to execute each op invocation. This mode of execution is referred to as eager mode evaluation."> .. only:: html .. image:: /auto_examples/images/thumb/sphx_glr_04_plot_eager_mode_evaluation_thumb.png :alt: :ref:`sphx_glr_auto_examples_04_plot_eager_mode_evaluation.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Eager mode evaluation</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="A ModelProto, in ONNX, usually stores extra information beyond the computational graph, such as ir_version or producer_name. Such properties of a generated ModelProto can be set by passing in extra named parameters to the call to script (or the call to to_model_proto), as illustrated by the example below. Only the valid fields defined in the protobuf message ModelProto should be specified in this fashion."> .. only:: html .. image:: /auto_examples/images/thumb/sphx_glr_05_plot_model_props_thumb.png :alt: :ref:`sphx_glr_auto_examples_05_plot_model_props.py` .. raw:: html <div class="sphx-glr-thumbnail-title">ModelProto Properties</div> </div> .. raw:: html <div class="sphx-glr-thumbcontainer" tooltip="A model in ONNX may contain model-local functions. When converting an onnxscript function to a ModelProto, the default behavior is to include function-definitions for all transitively called function-ops as model-local functions in the generated model (for which an onnxscript function definition has been seen). Callers can override this behavior by explicitly providing the list of FunctionProtos to be included in the generated model."> .. only:: html .. image:: /auto_examples/images/thumb/sphx_glr_06_plot_model_local_funs_thumb.png :alt: :ref:`sphx_glr_auto_examples_06_plot_model_local_funs.py` .. raw:: html <div class="sphx-glr-thumbnail-title">Model Local Functions</div> </div> .. thumbnail-parent-div-close .. raw:: html </div> .. toctree:: :hidden: /auto_examples/01_plot_selu /auto_examples/02_plot_square_loss /auto_examples/03_export_lib /auto_examples/04_plot_eager_mode_evaluation /auto_examples/05_plot_model_props /auto_examples/06_plot_model_local_funs .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-gallery .. container:: sphx-glr-download sphx-glr-download-python :download:`Download all examples in Python source code: auto_examples_python.zip </auto_examples/auto_examples_python.zip>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download all examples in Jupyter notebooks: auto_examples_jupyter.zip </auto_examples/auto_examples_jupyter.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_