mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-14 18:12:05 +00:00
* initial setup and rename "how to" to "setup" * move API to main nav * move api to main nav * add get starated, rework nav order * rename to install move mds out of install section * update api nav and home page * add install docs and python qs updates * python get started work * remove c and obj c for now * move java, python, and obj-c docs under api folder * move java api html to iframe (ugh) * remove api docs w/o details, move api text getstar * remove api docs wo detail updates get started * remvoe iframes * move eco system to main nav * fix api buttons * added more examples moved intro to ORT * fix links * fix get started titles * fix get started titles * fix more links * fix more links * more link fixes * fix nav remove inferencing and training subnav * fix top nav remove inference and training nav * fix title * fix tutorials nav hierarchy * fix python api button * add tenorflow keras example * fix quickstart toc * add imports fix spacing * fix links * update nav and python get started page * move ort training example, add coming soon for iot * update C# get started * fix spacing on quantization * Add some js get started content * fix formatting * fix typo * removed onnx-pytorch and onnx-tf * updated pip install torch and added links iot page * added pytorch tutorial heirarchy * updated web to docs soon added release blog link * add web link
142 lines
3.1 KiB
ReStructuredText
142 lines
3.1 KiB
ReStructuredText
|
|
.. DO NOT EDIT.
|
|
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
|
|
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
|
|
.. "auto_examples/plot_metadata.py"
|
|
.. LINE NUMBERS ARE GIVEN BELOW.
|
|
|
|
.. only:: html
|
|
|
|
.. note::
|
|
:class: sphx-glr-download-link-note
|
|
|
|
Click :ref:`here <sphx_glr_download_auto_examples_plot_metadata.py>`
|
|
to download the full example code
|
|
|
|
.. rst-class:: sphx-glr-example-title
|
|
|
|
.. _sphx_glr_auto_examples_plot_metadata.py:
|
|
|
|
|
|
Metadata
|
|
========
|
|
|
|
ONNX format contains metadata related to how the
|
|
model was produced. It is useful when the model
|
|
is deployed to production to keep track of which
|
|
instance was used at a specific time.
|
|
Let's see how to do that with a simple
|
|
logistic regression model trained with
|
|
*scikit-learn* and converted with *sklearn-onnx*.
|
|
|
|
.. GENERATED FROM PYTHON SOURCE LINES 16-31
|
|
|
|
.. code-block:: default
|
|
|
|
|
|
from onnxruntime.datasets import get_example
|
|
example = get_example("logreg_iris.onnx")
|
|
|
|
import onnx
|
|
model = onnx.load(example)
|
|
|
|
print("doc_string={}".format(model.doc_string))
|
|
print("domain={}".format(model.domain))
|
|
print("ir_version={}".format(model.ir_version))
|
|
print("metadata_props={}".format(model.metadata_props))
|
|
print("model_version={}".format(model.model_version))
|
|
print("producer_name={}".format(model.producer_name))
|
|
print("producer_version={}".format(model.producer_version))
|
|
|
|
|
|
|
|
|
|
|
|
.. rst-class:: sphx-glr-script-out
|
|
|
|
Out:
|
|
|
|
.. code-block:: none
|
|
|
|
doc_string=
|
|
domain=onnxml
|
|
ir_version=3
|
|
metadata_props=[]
|
|
model_version=0
|
|
producer_name=OnnxMLTools
|
|
producer_version=1.2.0.0116
|
|
|
|
|
|
|
|
|
|
.. GENERATED FROM PYTHON SOURCE LINES 32-33
|
|
|
|
With *ONNX Runtime*:
|
|
|
|
.. GENERATED FROM PYTHON SOURCE LINES 33-44
|
|
|
|
.. code-block:: default
|
|
|
|
|
|
from onnxruntime import InferenceSession
|
|
sess = InferenceSession(example)
|
|
meta = sess.get_modelmeta()
|
|
|
|
print("custom_metadata_map={}".format(meta.custom_metadata_map))
|
|
print("description={}".format(meta.description))
|
|
print("domain={}".format(meta.domain, meta.domain))
|
|
print("graph_name={}".format(meta.graph_name))
|
|
print("producer_name={}".format(meta.producer_name))
|
|
print("version={}".format(meta.version))
|
|
|
|
|
|
|
|
|
|
.. rst-class:: sphx-glr-script-out
|
|
|
|
Out:
|
|
|
|
.. code-block:: none
|
|
|
|
custom_metadata_map={}
|
|
description=
|
|
domain=onnxml
|
|
graph_name=3c59201b940f410fa29dc71ea9d5767d
|
|
producer_name=OnnxMLTools
|
|
version=0
|
|
|
|
|
|
|
|
|
|
|
|
.. rst-class:: sphx-glr-timing
|
|
|
|
**Total running time of the script:** ( 0 minutes 0.006 seconds)
|
|
|
|
|
|
.. _sphx_glr_download_auto_examples_plot_metadata.py:
|
|
|
|
|
|
.. only :: html
|
|
|
|
.. container:: sphx-glr-footer
|
|
:class: sphx-glr-footer-example
|
|
|
|
|
|
|
|
.. container:: sphx-glr-download sphx-glr-download-python
|
|
|
|
:download:`Download Python source code: plot_metadata.py <plot_metadata.py>`
|
|
|
|
|
|
|
|
.. container:: sphx-glr-download sphx-glr-download-jupyter
|
|
|
|
:download:`Download Jupyter notebook: plot_metadata.ipynb <plot_metadata.ipynb>`
|
|
|
|
|
|
.. only:: html
|
|
|
|
.. rst-class:: sphx-glr-signature
|
|
|
|
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
|