mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
[Automated]: Update Python API docs (#13927)
This commit is contained in:
parent
f4d3d5f975
commit
52a14e5adc
45 changed files with 403 additions and 13505 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Sphinx build info version 1
|
||||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
|
||||
config: 978b25a22c73c6c97974b1c827a546bd
|
||||
config: fa4364778ec99187343222d4f759e041
|
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="static/documentation_options.js"></script>
|
||||
<script src="static/jquery.js"></script>
|
||||
<script src="static/underscore.js"></script>
|
||||
<script src="static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="static/doctools.js"></script>
|
||||
<script src="static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
|
|
@ -51,7 +48,7 @@
|
|||
|
||||
<section id="api">
|
||||
<h1>API<a class="headerlink" href="#api" title="Permalink to this heading">¶</a></h1>
|
||||
<div class="contents local topic" id="contents">
|
||||
<nav class="contents local" id="contents">
|
||||
<ul class="simple">
|
||||
<li><p><a class="reference internal" href="#api-overview" id="id1">API Overview</a></p>
|
||||
<ul>
|
||||
|
|
@ -95,13 +92,13 @@
|
|||
</li>
|
||||
<li><p><a class="reference internal" href="#backend" id="id20">Backend</a></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<section id="api-overview">
|
||||
<h2><a class="toc-backref" href="#id1">API Overview</a><a class="headerlink" href="#api-overview" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id1" role="doc-backlink">API Overview</a><a class="headerlink" href="#api-overview" title="Permalink to this heading">¶</a></h2>
|
||||
<p><em>ONNX Runtime</em> loads and runs inference on a model in ONNX graph format, or ORT format (for memory and disk constrained environments).</p>
|
||||
<p>The data consumed and produced by the model can be specified and accessed in the way that best matches your scenario.</p>
|
||||
<section id="load-and-run-a-model">
|
||||
<h3><a class="toc-backref" href="#id2">Load and run a model</a><a class="headerlink" href="#load-and-run-a-model" title="Permalink to this heading">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id2" role="doc-backlink">Load and run a model</a><a class="headerlink" href="#load-and-run-a-model" title="Permalink to this heading">¶</a></h3>
|
||||
<p>InferenceSession is the main class of ONNX Runtime. It is used to load and run an ONNX model,
|
||||
as well as specify environment and application configuration options.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">session</span> <span class="o">=</span> <span class="n">onnxruntime</span><span class="o">.</span><span class="n">InferenceSession</span><span class="p">(</span><span class="s1">'model.onnx'</span><span class="p">)</span>
|
||||
|
|
@ -135,10 +132,10 @@ profiling on the session:</p>
|
|||
</div>
|
||||
</section>
|
||||
<section id="data-inputs-and-outputs">
|
||||
<h3><a class="toc-backref" href="#id3">Data inputs and outputs</a><a class="headerlink" href="#data-inputs-and-outputs" title="Permalink to this heading">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id3" role="doc-backlink">Data inputs and outputs</a><a class="headerlink" href="#data-inputs-and-outputs" title="Permalink to this heading">¶</a></h3>
|
||||
<p>The ONNX Runtime Inference Session consumes and produces data using its OrtValue class.</p>
|
||||
<section id="data-on-cpu">
|
||||
<h4><a class="toc-backref" href="#id4">Data on CPU</a><a class="headerlink" href="#data-on-cpu" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id4" role="doc-backlink">Data on CPU</a><a class="headerlink" href="#data-on-cpu" title="Permalink to this heading">¶</a></h4>
|
||||
<p>On CPU (the default), OrtValues can be mapped to and from native Python data structures: numpy arrays, dictionaries and lists of
|
||||
numpy arrays.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># X is numpy array on cpu</span>
|
||||
|
|
@ -159,7 +156,7 @@ may not optimal if the input or output is consumed and produced on a device
|
|||
other than CPU because it introduces data copy between CPU and the device.</p>
|
||||
</section>
|
||||
<section id="data-on-device">
|
||||
<h4><a class="toc-backref" href="#id5">Data on device</a><a class="headerlink" href="#data-on-device" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id5" role="doc-backlink">Data on device</a><a class="headerlink" href="#data-on-device" title="Permalink to this heading">¶</a></h4>
|
||||
<p><em>ONNX Runtime</em> supports a custom data structure that supports all ONNX data formats that allows users
|
||||
to place the data backing these on a device, for example, on a CUDA supported device. In ONNX Runtime,
|
||||
this called <cite>IOBinding</cite>.</p>
|
||||
|
|
@ -261,15 +258,15 @@ Users can thus consume the <em>ONNX Runtime</em> allocated memory for the output
|
|||
</section>
|
||||
</section>
|
||||
<section id="api-details">
|
||||
<h2><a class="toc-backref" href="#id6">API Details</a><a class="headerlink" href="#api-details" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id6" role="doc-backlink">API Details</a><a class="headerlink" href="#api-details" title="Permalink to this heading">¶</a></h2>
|
||||
<section id="inferencesession">
|
||||
<h3><a class="toc-backref" href="#id7">InferenceSession</a><a class="headerlink" href="#inferencesession" title="Permalink to this heading">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id7" role="doc-backlink">InferenceSession</a><a class="headerlink" href="#inferencesession" title="Permalink to this heading">¶</a></h3>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.InferenceSession">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">InferenceSession</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path_or_bytes</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sess_options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">providers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">provider_options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#InferenceSession"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.InferenceSession" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>This is the main class used to run a model.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>path_or_bytes</strong> – filename or serialized ONNX or ORT format model in a byte string</p></li>
|
||||
<li><p><strong>sess_options</strong> – session options</p></li>
|
||||
|
|
@ -382,14 +379,14 @@ For instance, on Windows and MacOS, the precision will be ~100ns</p>
|
|||
<span class="sig-name descname"><span class="pre">run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_names</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">input_feed</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">run_options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.InferenceSession.run" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Compute the predictions.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>output_names</strong> – name of the outputs</p></li>
|
||||
<li><p><strong>input_feed</strong> – dictionary <code class="docutils literal notranslate"><span class="pre">{</span> <span class="pre">input_name:</span> <span class="pre">input_value</span> <span class="pre">}</span></code></p></li>
|
||||
<li><p><strong>run_options</strong> – See <a class="reference internal" href="#onnxruntime.RunOptions" title="onnxruntime.RunOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.RunOptions</span></code></a>.</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dt class="field-even">Returns<span class="colon">:</span></dt>
|
||||
<dd class="field-even"><p>list of results, every result is either a numpy array,
|
||||
a sparse tensor, a list or a dictionary.</p>
|
||||
</dd>
|
||||
|
|
@ -404,7 +401,7 @@ a sparse tensor, a list or a dictionary.</p>
|
|||
<span class="sig-name descname"><span class="pre">run_with_iobinding</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">iobinding</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">run_options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.InferenceSession.run_with_iobinding" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Compute the predictions.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>iobinding</strong> – the iobinding object that has graph inputs/outputs bind.</p></li>
|
||||
<li><p><strong>run_options</strong> – See <a class="reference internal" href="#onnxruntime.RunOptions" title="onnxruntime.RunOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.RunOptions</span></code></a>.</p></li>
|
||||
|
|
@ -418,7 +415,7 @@ a sparse tensor, a list or a dictionary.</p>
|
|||
<span class="sig-name descname"><span class="pre">run_with_ort_values</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_names</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">input_dict_ort_values</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">run_options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.InferenceSession.run_with_ort_values" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Compute the predictions.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>output_names</strong> – name of the outputs</p></li>
|
||||
<li><p><strong>input_dict_ort_values</strong> – dictionary <code class="docutils literal notranslate"><span class="pre">{</span> <span class="pre">input_name:</span> <span class="pre">input_ort_value</span> <span class="pre">}</span></code>
|
||||
|
|
@ -427,7 +424,7 @@ from numpy array or <cite>SparseTensor</cite></p></li>
|
|||
<li><p><strong>run_options</strong> – See <a class="reference internal" href="#onnxruntime.RunOptions" title="onnxruntime.RunOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.RunOptions</span></code></a>.</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dt class="field-even">Returns<span class="colon">:</span></dt>
|
||||
<dd class="field-even"><p>an array of <cite>OrtValue</cite></p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -441,7 +438,7 @@ from numpy array or <cite>SparseTensor</cite></p></li>
|
|||
<span class="sig-name descname"><span class="pre">run_with_ortvaluevector</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">run_options</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">feed_names</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">feeds</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fetch_names</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fetches</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">fetch_devices</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.InferenceSession.run_with_ortvaluevector" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Compute the predictions similar to other run_*() methods but with minimal C++/Python conversion overhead.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>run_options</strong> – See <a class="reference internal" href="#onnxruntime.RunOptions" title="onnxruntime.RunOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.RunOptions</span></code></a>.</p></li>
|
||||
<li><p><strong>feed_names</strong> – list of input names.</p></li>
|
||||
|
|
@ -459,7 +456,7 @@ from numpy array or <cite>SparseTensor</cite></p></li>
|
|||
<span class="sig-name descname"><span class="pre">set_providers</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">providers</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">provider_options</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.InferenceSession.set_providers" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Register the input list of execution providers. The underlying session is re-created.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>providers</strong> – Optional sequence of providers in order of decreasing
|
||||
precedence. Values can either be provider names or tuples of
|
||||
|
|
@ -482,9 +479,9 @@ otherwise execute using CPUExecutionProvider.</p>
|
|||
|
||||
</section>
|
||||
<section id="options">
|
||||
<h3><a class="toc-backref" href="#id8">Options</a><a class="headerlink" href="#options" title="Permalink to this heading">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id8" role="doc-backlink">Options</a><a class="headerlink" href="#options" title="Permalink to this heading">¶</a></h3>
|
||||
<section id="runoptions">
|
||||
<h4><a class="toc-backref" href="#id9">RunOptions</a><a class="headerlink" href="#runoptions" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id9" role="doc-backlink">RunOptions</a><a class="headerlink" href="#runoptions" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.RunOptions">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">RunOptions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#onnxruntime.RunOptions" title="onnxruntime.capi.onnxruntime_pybind11_state.RunOptions"><span class="pre">onnxruntime.capi.onnxruntime_pybind11_state.RunOptions</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.RunOptions" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -543,7 +540,7 @@ RunOptions instance. The individual calls will exit gracefully and return an err
|
|||
|
||||
</section>
|
||||
<section id="sessionoptions">
|
||||
<h4><a class="toc-backref" href="#id10">SessionOptions</a><a class="headerlink" href="#sessionoptions" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id10" role="doc-backlink">SessionOptions</a><a class="headerlink" href="#sessionoptions" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.SessionOptions">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">SessionOptions</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#onnxruntime.SessionOptions" title="onnxruntime.capi.onnxruntime_pybind11_state.SessionOptions"><span class="pre">onnxruntime.capi.onnxruntime_pybind11_state.SessionOptions</span></a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.SessionOptions" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -690,9 +687,9 @@ Serialized model format will default to ONNX unless:
|
|||
</section>
|
||||
</section>
|
||||
<section id="data">
|
||||
<h3><a class="toc-backref" href="#id11">Data</a><a class="headerlink" href="#data" title="Permalink to this heading">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id11" role="doc-backlink">Data</a><a class="headerlink" href="#data" title="Permalink to this heading">¶</a></h3>
|
||||
<section id="ortvalue">
|
||||
<h4><a class="toc-backref" href="#id12">OrtValue</a><a class="headerlink" href="#ortvalue" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id12" role="doc-backlink">OrtValue</a><a class="headerlink" href="#ortvalue" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.OrtValue">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">OrtValue</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ortvalue</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">numpy_obj</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#OrtValue"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.OrtValue" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -776,7 +773,7 @@ The new instance of OrtValue will assume the ownership of sparse_tensor</p>
|
|||
<dd><p>Factory method to construct an OrtValue (which holds a Tensor) from a given Numpy object
|
||||
A copy of the data in the Numpy object is held by the OrtValue only if the device is NOT cpu</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>numpy_obj</strong> – The Numpy object to construct the OrtValue from</p></li>
|
||||
<li><p><strong>device_type</strong> – e.g. cpu, cuda, cpu by default</p></li>
|
||||
|
|
@ -791,7 +788,7 @@ A copy of the data in the Numpy object is held by the OrtValue only if the devic
|
|||
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ortvalue_from_shape_and_type</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">element_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'cpu'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#OrtValue.ortvalue_from_shape_and_type"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.OrtValue.ortvalue_from_shape_and_type" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Factory method to construct an OrtValue (which holds a Tensor) from given shape and element_type</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>shape</strong> – List of integers indicating the shape of the OrtValue</p></li>
|
||||
<li><p><strong>element_type</strong> – The data type of the elements in the OrtValue (numpy type)</p></li>
|
||||
|
|
@ -822,7 +819,7 @@ the memory address can not be changed.</p>
|
|||
|
||||
</section>
|
||||
<section id="sparsetensor">
|
||||
<h4><a class="toc-backref" href="#id13">SparseTensor</a><a class="headerlink" href="#sparsetensor" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id13" role="doc-backlink">SparseTensor</a><a class="headerlink" href="#sparsetensor" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.SparseTensor">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">SparseTensor</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sparse_tensor</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#SparseTensor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.SparseTensor" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -897,7 +894,7 @@ You can query indices as:</p>
|
|||
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">sparse_coo_from_numpy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dense_shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">values</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coo_indices</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ort_device</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#SparseTensor.sparse_coo_from_numpy"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.SparseTensor.sparse_coo_from_numpy" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Factory method to construct a SparseTensor in COO format from given arguments</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>dense_shape</strong> – 1-D numpy array(int64) or a python list that contains a dense_shape of the sparse tensor
|
||||
must be on cpu memory</p></li>
|
||||
|
|
@ -927,7 +924,7 @@ on other devices and their memory can not be mapped.</p>
|
|||
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">sparse_csr_from_numpy</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dense_shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">values</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inner_indices</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">outer_indices</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ort_device</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#SparseTensor.sparse_csr_from_numpy"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.SparseTensor.sparse_csr_from_numpy" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Factory method to construct a SparseTensor in CSR format from given arguments</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>dense_shape</strong> – 1-D numpy array(int64) or a python list that contains a dense_shape of the
|
||||
sparse tensor (rows, cols) must be on cpu memory</p></li>
|
||||
|
|
@ -957,7 +954,7 @@ on other devices and their memory can not be mapped.</p>
|
|||
<span class="sig-name descname"><span class="pre">to_cuda</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ort_device</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#SparseTensor.to_cuda"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.SparseTensor.to_cuda" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Returns a copy of this instance on the specified cuda device</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><p><strong>ort_device</strong> – with name ‘cuda’ and valid gpu device id</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -983,9 +980,9 @@ copies of the strings.</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="devices">
|
||||
<h3><a class="toc-backref" href="#id14">Devices</a><a class="headerlink" href="#devices" title="Permalink to this heading">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id14" role="doc-backlink">Devices</a><a class="headerlink" href="#devices" title="Permalink to this heading">¶</a></h3>
|
||||
<section id="iobinding">
|
||||
<h4><a class="toc-backref" href="#id15">IOBinding</a><a class="headerlink" href="#iobinding" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id15" role="doc-backlink">IOBinding</a><a class="headerlink" href="#iobinding" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.IOBinding">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">IOBinding</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">session</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#IOBinding"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.IOBinding" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -1002,7 +999,7 @@ copies of the strings.</p>
|
|||
<dt class="sig sig-object py" id="onnxruntime.IOBinding.bind_input">
|
||||
<span class="sig-name descname"><span class="pre">bind_input</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">element_type</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shape</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">buffer_ptr</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#IOBinding.bind_input"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.IOBinding.bind_input" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>name</strong> – input name</p></li>
|
||||
<li><p><strong>device_type</strong> – e.g. cpu, cuda</p></li>
|
||||
|
|
@ -1019,7 +1016,7 @@ copies of the strings.</p>
|
|||
<dt class="sig sig-object py" id="onnxruntime.IOBinding.bind_ortvalue_input">
|
||||
<span class="sig-name descname"><span class="pre">bind_ortvalue_input</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ortvalue</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#IOBinding.bind_ortvalue_input"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.IOBinding.bind_ortvalue_input" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>name</strong> – input name</p></li>
|
||||
<li><p><strong>ortvalue</strong> – OrtValue instance to bind</p></li>
|
||||
|
|
@ -1032,7 +1029,7 @@ copies of the strings.</p>
|
|||
<dt class="sig sig-object py" id="onnxruntime.IOBinding.bind_ortvalue_output">
|
||||
<span class="sig-name descname"><span class="pre">bind_ortvalue_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ortvalue</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#IOBinding.bind_ortvalue_output"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.IOBinding.bind_ortvalue_output" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>name</strong> – output name</p></li>
|
||||
<li><p><strong>ortvalue</strong> – OrtValue instance to bind</p></li>
|
||||
|
|
@ -1045,7 +1042,7 @@ copies of the strings.</p>
|
|||
<dt class="sig sig-object py" id="onnxruntime.IOBinding.bind_output">
|
||||
<span class="sig-name descname"><span class="pre">bind_output</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">name</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'cpu'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device_id</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">element_type</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">shape</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">buffer_ptr</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#IOBinding.bind_output"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.IOBinding.bind_output" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>name</strong> – output name</p></li>
|
||||
<li><p><strong>device_type</strong> – e.g. cpu, cuda, cpu by default</p></li>
|
||||
|
|
@ -1075,7 +1072,7 @@ The data buffer of the obtained OrtValues may not reside on CPU memory</p>
|
|||
|
||||
</section>
|
||||
<section id="ortdevice">
|
||||
<h4><a class="toc-backref" href="#id16">OrtDevice</a><a class="headerlink" href="#ortdevice" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id16" role="doc-backlink">OrtDevice</a><a class="headerlink" href="#ortdevice" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.OrtDevice">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">OrtDevice</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">c_ort_device</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="modules/onnxruntime/capi/onnxruntime_inference_collection.html#OrtDevice"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#onnxruntime.OrtDevice" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -1086,11 +1083,11 @@ The data buffer of the obtained OrtValues may not reside on CPU memory</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="internal-classes">
|
||||
<h3><a class="toc-backref" href="#id17">Internal classes</a><a class="headerlink" href="#internal-classes" title="Permalink to this heading">¶</a></h3>
|
||||
<h3><a class="toc-backref" href="#id17" role="doc-backlink">Internal classes</a><a class="headerlink" href="#internal-classes" title="Permalink to this heading">¶</a></h3>
|
||||
<p>These classes cannot be instantiated by users but they are returned
|
||||
by methods or functions of this library.</p>
|
||||
<section id="modelmetadata">
|
||||
<h4><a class="toc-backref" href="#id18">ModelMetadata</a><a class="headerlink" href="#modelmetadata" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id18" role="doc-backlink">ModelMetadata</a><a class="headerlink" href="#modelmetadata" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.ModelMetadata">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">ModelMetadata</span></span><a class="headerlink" href="#onnxruntime.ModelMetadata" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -1143,7 +1140,7 @@ facilitate the comparison.</p>
|
|||
|
||||
</section>
|
||||
<section id="nodearg">
|
||||
<h4><a class="toc-backref" href="#id19">NodeArg</a><a class="headerlink" href="#nodearg" title="Permalink to this heading">¶</a></h4>
|
||||
<h4><a class="toc-backref" href="#id19" role="doc-backlink">NodeArg</a><a class="headerlink" href="#nodearg" title="Permalink to this heading">¶</a></h4>
|
||||
<dl class="py class">
|
||||
<dt class="sig sig-object py" id="onnxruntime.NodeArg">
|
||||
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">onnxruntime.</span></span><span class="sig-name descname"><span class="pre">NodeArg</span></span><a class="headerlink" href="#onnxruntime.NodeArg" title="Permalink to this definition">¶</a></dt>
|
||||
|
|
@ -1173,7 +1170,7 @@ including arg name, arg type (contains both type and shape).</p>
|
|||
</section>
|
||||
</section>
|
||||
<section id="backend">
|
||||
<h2><a class="toc-backref" href="#id20">Backend</a><a class="headerlink" href="#backend" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id20" role="doc-backlink">Backend</a><a class="headerlink" href="#backend" title="Permalink to this heading">¶</a></h2>
|
||||
<p>In addition to the regular API which is optimized for performance and usability,
|
||||
<em>ONNX Runtime</em> also implements the
|
||||
<a class="reference external" href="https://github.com/onnx/onnx/blob/main/docs/ImplementingAnOnnxBackend.md">ONNX backend API</a>
|
||||
|
|
@ -1184,13 +1181,13 @@ The following functions are supported:</p>
|
|||
<span class="sig-prename descclassname"><span class="pre">onnxruntime.backend.</span></span><span class="sig-name descname"><span class="pre">is_compatible</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.backend.is_compatible" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return whether the model is compatible with the backend.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>model</strong> – unused</p></li>
|
||||
<li><p><strong>device</strong> – None to use the default device or a string (ex: <cite>‘CPU’</cite>)</p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dt class="field-even">Returns<span class="colon">:</span></dt>
|
||||
<dd class="field-even"><p>boolean</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -1202,7 +1199,7 @@ The following functions are supported:</p>
|
|||
<dd><p>Load the model and creates a <a class="reference internal" href="#onnxruntime.InferenceSession" title="onnxruntime.InferenceSession"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.InferenceSession</span></code></a>
|
||||
ready to be used as a backend.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>model</strong> – ModelProto (returned by <cite>onnx.load</cite>),
|
||||
string for a filename or bytes for a serialized model</p></li>
|
||||
|
|
@ -1212,7 +1209,7 @@ the compilation settings</p></li>
|
|||
<li><p><strong>kwargs</strong> – see <a class="reference internal" href="#onnxruntime.SessionOptions" title="onnxruntime.SessionOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.SessionOptions</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dt class="field-even">Returns<span class="colon">:</span></dt>
|
||||
<dd class="field-even"><p><a class="reference internal" href="#onnxruntime.InferenceSession" title="onnxruntime.InferenceSession"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.InferenceSession</span></code></a></p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -1223,7 +1220,7 @@ the compilation settings</p></li>
|
|||
<span class="sig-prename descclassname"><span class="pre">onnxruntime.backend.</span></span><span class="sig-name descname"><span class="pre">run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">inputs</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">device</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#onnxruntime.backend.run" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Compute the prediction.</p>
|
||||
<dl class="field-list simple">
|
||||
<dt class="field-odd">Parameters</dt>
|
||||
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
|
||||
<dd class="field-odd"><ul class="simple">
|
||||
<li><p><strong>model</strong> – <a class="reference internal" href="#onnxruntime.InferenceSession" title="onnxruntime.InferenceSession"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.InferenceSession</span></code></a> returned
|
||||
by function <em>prepare</em></p></li>
|
||||
|
|
@ -1234,7 +1231,7 @@ the compilation settings</p></li>
|
|||
<li><p><strong>kwargs</strong> – see <a class="reference internal" href="#onnxruntime.RunOptions" title="onnxruntime.RunOptions"><code class="xref py py-class docutils literal notranslate"><span class="pre">onnxruntime.RunOptions</span></code></a></p></li>
|
||||
</ul>
|
||||
</dd>
|
||||
<dt class="field-even">Returns</dt>
|
||||
<dt class="field-even">Returns<span class="colon">:</span></dt>
|
||||
<dd class="field-even"><p>predictions</p>
|
||||
</dd>
|
||||
</dl>
|
||||
|
|
@ -1311,8 +1308,8 @@ In particular it’s used in the testing suite.</p>
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="sources/api_summary.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -151,8 +148,8 @@
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/index.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -112,7 +109,7 @@ without using <em>onnx</em>.</p>
|
|||
<p>The backend API is implemented by other frameworks
|
||||
and makes it easier to switch between multiple runtimes
|
||||
with the same API.</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.021 seconds)</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.019 seconds)</p>
|
||||
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-backend-py">
|
||||
<div class="sphx-glr-download sphx-glr-download-python docutils container">
|
||||
<p><a class="reference download internal" download="" href="../downloads/3e23fa9ebb26f4728ee8426ed7da0f63/plot_backend.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_backend.py</span></code></a></p>
|
||||
|
|
@ -187,8 +184,8 @@ with the same API.</p>
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_backend.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -209,7 +206,7 @@ ERROR with Shape=(1, 1, 3) - [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Invalid
|
|||
ERROR with Shape=(2, 1, 2) - [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Invalid rank for input: float_input Got: 3 Expected: 2 Please fix either the inputs or the model.
|
||||
</pre></div>
|
||||
</div>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.014 seconds)</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.011 seconds)</p>
|
||||
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-common-errors-py">
|
||||
<div class="sphx-glr-download sphx-glr-download-python docutils container">
|
||||
<p><a class="reference download internal" download="" href="../downloads/3a2955e44bf8f95a0eee6e71695ad788/plot_common_errors.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_common_errors.py</span></code></a></p>
|
||||
|
|
@ -284,8 +281,8 @@ ERROR with Shape=(2, 1, 2) - [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Invalid
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_common_errors.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -61,14 +58,14 @@ starting with the training of a scikit-learn pipeline
|
|||
which takes as inputs not a regular vector but a
|
||||
dictionary <code class="docutils literal notranslate"><span class="pre">{</span> <span class="pre">int:</span> <span class="pre">float</span> <span class="pre">}</span></code> as its first step is a
|
||||
<a class="reference external" href="http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.DictVectorizer.html">DictVectorizer</a>.</p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<nav class="contents local" id="contents">
|
||||
<ul class="simple">
|
||||
<li><p><a class="reference internal" href="#train-a-pipeline" id="id1">Train a pipeline</a></p></li>
|
||||
<li><p><a class="reference internal" href="#conversion-to-onnx-format" id="id2">Conversion to ONNX format</a></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<section id="train-a-pipeline">
|
||||
<h2><a class="toc-backref" href="#id1">Train a pipeline</a><a class="headerlink" href="#train-a-pipeline" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id1" role="doc-backlink">Train a pipeline</a><a class="headerlink" href="#train-a-pipeline" title="Permalink to this heading">¶</a></h2>
|
||||
<p>The first step consists in retrieving the boston datset.</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">pandas</span>
|
||||
<span class="kn">from</span> <span class="nn">sklearn.datasets</span> <span class="kn">import</span> <span class="n">load_boston</span>
|
||||
|
|
@ -143,12 +140,12 @@ and we show the confusion matrix.</p>
|
|||
<span class="nb">print</span><span class="p">(</span><span class="n">r2_score</span><span class="p">(</span><span class="n">y_test</span><span class="p">,</span> <span class="n">pred</span><span class="p">))</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>0.8474132062469484
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>0.92310182911155
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="conversion-to-onnx-format">
|
||||
<h2><a class="toc-backref" href="#id2">Conversion to ONNX format</a><a class="headerlink" href="#conversion-to-onnx-format" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Conversion to ONNX format</a><a class="headerlink" href="#conversion-to-onnx-format" title="Permalink to this heading">¶</a></h2>
|
||||
<p>We use module
|
||||
<a class="reference external" href="https://github.com/onnx/sklearn-onnx">sklearn-onnx</a>
|
||||
to convert the model into ONNX format.</p>
|
||||
|
|
@ -200,12 +197,12 @@ ONNX Runtime expects one observation at a time.</p>
|
|||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="nb">print</span><span class="p">(</span><span class="n">r2_score</span><span class="p">(</span><span class="n">pred</span><span class="p">,</span> <span class="n">pred_onx</span><span class="p">))</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>0.9999999999999123
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>0.9999999999999366
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Very similar. <em>ONNX Runtime</em> uses floats instead of doubles,
|
||||
that explains the small discrepencies.</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 1.374 seconds)</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 1.392 seconds)</p>
|
||||
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-convert-pipeline-vectorizer-py">
|
||||
<div class="sphx-glr-download sphx-glr-download-python docutils container">
|
||||
<p><a class="reference download internal" download="" href="../downloads/982a1f7abbb8ffc5d5e98b671c35e5aa/plot_convert_pipeline_vectorizer.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_convert_pipeline_vectorizer.py</span></code></a></p>
|
||||
|
|
@ -281,8 +278,8 @@ that explains the small discrepencies.</p>
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_convert_pipeline_vectorizer.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -108,24 +105,24 @@ output type tensor(float)
|
|||
<span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[array([[[0.72821426, 0.6339202 , 0.7272735 , 0.6409311 , 0.61518466],
|
||||
[0.7185246 , 0.640914 , 0.60131776, 0.6857518 , 0.70039463],
|
||||
[0.7135308 , 0.65056884, 0.58760184, 0.7135416 , 0.63284004],
|
||||
[0.7188247 , 0.5470599 , 0.58532 , 0.67812634, 0.6893187 ]],
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[array([[[0.6741172 , 0.7219819 , 0.61369073, 0.7058611 , 0.6851099 ],
|
||||
[0.65471834, 0.59070265, 0.6932085 , 0.58628637, 0.68116176],
|
||||
[0.6053132 , 0.6046966 , 0.5977106 , 0.5027518 , 0.6936471 ],
|
||||
[0.584405 , 0.5433203 , 0.71175635, 0.5528623 , 0.66580206]],
|
||||
|
||||
[[0.6211655 , 0.554035 , 0.55418974, 0.56652635, 0.62399405],
|
||||
[0.55780345, 0.6938668 , 0.5910147 , 0.59314 , 0.54391265],
|
||||
[0.7126377 , 0.65041703, 0.62936115, 0.69839984, 0.5651956 ],
|
||||
[0.6023196 , 0.6012137 , 0.7164181 , 0.59447944, 0.7121656 ]],
|
||||
[[0.54814535, 0.5123932 , 0.68307173, 0.72042155, 0.63475394],
|
||||
[0.64413285, 0.70860803, 0.6923877 , 0.5770614 , 0.53430355],
|
||||
[0.57739794, 0.6555867 , 0.6817992 , 0.6585449 , 0.593924 ],
|
||||
[0.64254063, 0.6924439 , 0.7242955 , 0.7274165 , 0.55333275]],
|
||||
|
||||
[[0.6137416 , 0.65805656, 0.6757898 , 0.7231871 , 0.6186665 ],
|
||||
[0.662174 , 0.61860013, 0.6509645 , 0.57368857, 0.689906 ],
|
||||
[0.7140595 , 0.7226651 , 0.6117408 , 0.5281206 , 0.69103116],
|
||||
[0.7082236 , 0.7197187 , 0.6111821 , 0.6187154 , 0.53502613]]],
|
||||
[[0.6204574 , 0.551248 , 0.54466 , 0.70989406, 0.5772743 ],
|
||||
[0.67696744, 0.5659738 , 0.6278838 , 0.51225674, 0.6547737 ],
|
||||
[0.6698583 , 0.527287 , 0.7128138 , 0.500769 , 0.6947695 ],
|
||||
[0.5108964 , 0.694841 , 0.50497264, 0.6312783 , 0.7083145 ]]],
|
||||
dtype=float32)]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.013 seconds)</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.007 seconds)</p>
|
||||
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-load-and-predict-py">
|
||||
<div class="sphx-glr-download sphx-glr-download-python docutils container">
|
||||
<p><a class="reference download internal" download="" href="../downloads/7c8424f45d0156abd4d0221c65601124/plot_load_and_predict.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_load_and_predict.py</span></code></a></p>
|
||||
|
|
@ -200,8 +197,8 @@ output type tensor(float)
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_load_and_predict.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -111,7 +108,7 @@ producer_name=OnnxMLTools
|
|||
version=0
|
||||
</pre></div>
|
||||
</div>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.010 seconds)</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.004 seconds)</p>
|
||||
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-metadata-py">
|
||||
<div class="sphx-glr-download sphx-glr-download-python docutils container">
|
||||
<p><a class="reference download internal" download="" href="../downloads/932fe1ee7f48f55a6155d2f378bc85a0/plot_metadata.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_metadata.py</span></code></a></p>
|
||||
|
|
@ -186,8 +183,8 @@ version=0
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_metadata.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -61,14 +58,14 @@ in ONNX format than looking into its node with
|
|||
<em>onnx</em>. This example demonstrates
|
||||
how to draw a model and to retrieve it in <em>json</em>
|
||||
format.</p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<nav class="contents local" id="contents">
|
||||
<ul class="simple">
|
||||
<li><p><a class="reference internal" href="#retrieve-a-model-in-json-format" id="id1">Retrieve a model in JSON format</a></p></li>
|
||||
<li><p><a class="reference internal" href="#draw-a-model-with-onnx" id="id2">Draw a model with ONNX</a></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<section id="retrieve-a-model-in-json-format">
|
||||
<h2><a class="toc-backref" href="#id1">Retrieve a model in JSON format</a><a class="headerlink" href="#retrieve-a-model-in-json-format" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id1" role="doc-backlink">Retrieve a model in JSON format</a><a class="headerlink" href="#retrieve-a-model-in-json-format" title="Permalink to this heading">¶</a></h2>
|
||||
<p>That’s the most simple way.</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">onnxruntime.datasets</span> <span class="kn">import</span> <span class="n">get_example</span>
|
||||
|
||||
|
|
@ -145,7 +142,7 @@ opset_import {
|
|||
</div>
|
||||
</section>
|
||||
<section id="draw-a-model-with-onnx">
|
||||
<h2><a class="toc-backref" href="#id2">Draw a model with ONNX</a><a class="headerlink" href="#draw-a-model-with-onnx" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Draw a model with ONNX</a><a class="headerlink" href="#draw-a-model-with-onnx" title="Permalink to this heading">¶</a></h2>
|
||||
<p>We use <a class="reference external" href="https://github.com/onnx/onnx/blob/main/onnx/tools/net_drawer.py">net_drawer.py</a>
|
||||
included in <em>onnx</em> package.
|
||||
We use <em>onnx</em> to load the model
|
||||
|
|
@ -183,10 +180,10 @@ in a different way than before.</p>
|
|||
<span class="n">plt</span><span class="o">.</span><span class="n">imshow</span><span class="p">(</span><span class="n">image</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<img src="../images/sphx_glr_plot_pipeline_001.png" srcset="../images/sphx_glr_plot_pipeline_001.png" alt="plot pipeline" class = "sphx-glr-single-img"/><div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span><matplotlib.image.AxesImage object at 0x7f3f51301840>
|
||||
<img src="../images/sphx_glr_plot_pipeline_001.png" srcset="../images/sphx_glr_plot_pipeline_001.png" alt="plot pipeline" class = "sphx-glr-single-img"/><div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span><matplotlib.image.AxesImage object at 0x7f2b5427f280>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.322 seconds)</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.290 seconds)</p>
|
||||
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-pipeline-py">
|
||||
<div class="sphx-glr-download sphx-glr-download-python docutils container">
|
||||
<p><a class="reference download internal" download="" href="../downloads/d436e9922b51a71358604ec00f09e7e4/plot_pipeline.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_pipeline.py</span></code></a></p>
|
||||
|
|
@ -262,8 +259,8 @@ in a different way than before.</p>
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_pipeline.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -106,7 +103,7 @@ before running the predictions.</p>
|
|||
<span class="nb">print</span><span class="p">(</span><span class="n">prof_file</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>onnxruntime_profile__2022-12-09_23-45-49.json
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>onnxruntime_profile__2023-01-20_00-04-24.json
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The results are stored un a file in JSON format.
|
||||
|
|
@ -122,20 +119,20 @@ Let’s see what it contains.</p>
|
|||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[{'args': {},
|
||||
'cat': 'Session',
|
||||
'dur': 65,
|
||||
'dur': 83,
|
||||
'name': 'model_loading_array',
|
||||
'ph': 'X',
|
||||
'pid': 2734,
|
||||
'tid': 2734,
|
||||
'ts': 1},
|
||||
'pid': 2666,
|
||||
'tid': 2666,
|
||||
'ts': 2},
|
||||
{'args': {},
|
||||
'cat': 'Session',
|
||||
'dur': 329,
|
||||
'dur': 335,
|
||||
'name': 'session_initialization',
|
||||
'ph': 'X',
|
||||
'pid': 2734,
|
||||
'tid': 2734,
|
||||
'ts': 83}]
|
||||
'pid': 2666,
|
||||
'tid': 2666,
|
||||
'ts': 103}]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 0 minutes 0.007 seconds)</p>
|
||||
|
|
@ -213,8 +210,8 @@ Let’s see what it contains.</p>
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_profiling.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -58,16 +55,16 @@ to download the full example code</p>
|
|||
<p>This example demonstrates an end to end scenario
|
||||
starting with the training of a machine learned model
|
||||
to its use in its converted from.</p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<nav class="contents local" id="contents">
|
||||
<ul class="simple">
|
||||
<li><p><a class="reference internal" href="#train-a-logistic-regression" id="id1">Train a logistic regression</a></p></li>
|
||||
<li><p><a class="reference internal" href="#conversion-to-onnx-format" id="id2">Conversion to ONNX format</a></p></li>
|
||||
<li><p><a class="reference internal" href="#probabilities" id="id3">Probabilities</a></p></li>
|
||||
<li><p><a class="reference internal" href="#benchmark-with-randomforest" id="id4">Benchmark with RandomForest</a></p></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<section id="train-a-logistic-regression">
|
||||
<h2><a class="toc-backref" href="#id1">Train a logistic regression</a><a class="headerlink" href="#train-a-logistic-regression" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id1" role="doc-backlink">Train a logistic regression</a><a class="headerlink" href="#train-a-logistic-regression" title="Permalink to this heading">¶</a></h2>
|
||||
<p>The first step consists in retrieving the iris datset.</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">sklearn.datasets</span> <span class="kn">import</span> <span class="n">load_iris</span>
|
||||
|
||||
|
|
@ -86,6 +83,16 @@ to its use in its converted from.</p>
|
|||
<span class="n">clr</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X_train</span><span class="p">,</span> <span class="n">y_train</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>/home/runner/.local/lib/python3.10/site-packages/sklearn/linear_model/_logistic.py:444: ConvergenceWarning: lbfgs failed to converge (status=1):
|
||||
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
|
||||
|
||||
Increase the number of iterations (max_iter) or scale the data as shown in:
|
||||
https://scikit-learn.org/stable/modules/preprocessing.html
|
||||
Please also refer to the documentation for alternative solver options:
|
||||
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
|
||||
n_iter_i = _check_optimize_result(
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="output_subarea output_html rendered_html output_result">
|
||||
<style>#sk-container-id-2 {color: black;background-color: white;}#sk-container-id-2 pre{padding: 0;}#sk-container-id-2 div.sk-toggleable {background-color: white;}#sk-container-id-2 label.sk-toggleable__label {cursor: pointer;display: block;width: 100%;margin-bottom: 0;padding: 0.3em;box-sizing: border-box;text-align: center;}#sk-container-id-2 label.sk-toggleable__label-arrow:before {content: "▸";float: left;margin-right: 0.25em;color: #696969;}#sk-container-id-2 label.sk-toggleable__label-arrow:hover:before {color: black;}#sk-container-id-2 div.sk-estimator:hover label.sk-toggleable__label-arrow:before {color: black;}#sk-container-id-2 div.sk-toggleable__content {max-height: 0;max-width: 0;overflow: hidden;text-align: left;background-color: #f0f8ff;}#sk-container-id-2 div.sk-toggleable__content pre {margin: 0.2em;color: black;border-radius: 0.25em;background-color: #f0f8ff;}#sk-container-id-2 input.sk-toggleable__control:checked~div.sk-toggleable__content {max-height: 200px;max-width: 100%;overflow: auto;}#sk-container-id-2 input.sk-toggleable__control:checked~label.sk-toggleable__label-arrow:before {content: "▾";}#sk-container-id-2 div.sk-estimator input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-label input.sk-toggleable__control:checked~label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 input.sk-hidden--visually {border: 0;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);height: 1px;margin: -1px;overflow: hidden;padding: 0;position: absolute;width: 1px;}#sk-container-id-2 div.sk-estimator {font-family: monospace;background-color: #f0f8ff;border: 1px dotted black;border-radius: 0.25em;box-sizing: border-box;margin-bottom: 0.5em;}#sk-container-id-2 div.sk-estimator:hover {background-color: #d4ebff;}#sk-container-id-2 div.sk-parallel-item::after {content: "";width: 100%;border-bottom: 1px solid gray;flex-grow: 1;}#sk-container-id-2 div.sk-label:hover label.sk-toggleable__label {background-color: #d4ebff;}#sk-container-id-2 div.sk-serial::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: 0;}#sk-container-id-2 div.sk-serial {display: flex;flex-direction: column;align-items: center;background-color: white;padding-right: 0.2em;padding-left: 0.2em;position: relative;}#sk-container-id-2 div.sk-item {position: relative;z-index: 1;}#sk-container-id-2 div.sk-parallel {display: flex;align-items: stretch;justify-content: center;background-color: white;position: relative;}#sk-container-id-2 div.sk-item::before, #sk-container-id-2 div.sk-parallel-item::before {content: "";position: absolute;border-left: 1px solid gray;box-sizing: border-box;top: 0;bottom: 0;left: 50%;z-index: -1;}#sk-container-id-2 div.sk-parallel-item {display: flex;flex-direction: column;z-index: 1;position: relative;background-color: white;}#sk-container-id-2 div.sk-parallel-item:first-child::after {align-self: flex-end;width: 50%;}#sk-container-id-2 div.sk-parallel-item:last-child::after {align-self: flex-start;width: 50%;}#sk-container-id-2 div.sk-parallel-item:only-child::after {width: 0;}#sk-container-id-2 div.sk-dashed-wrapped {border: 1px dashed gray;margin: 0 0.4em 0.5em 0.4em;box-sizing: border-box;padding-bottom: 0.4em;background-color: white;}#sk-container-id-2 div.sk-label label {font-family: monospace;font-weight: bold;display: inline-block;line-height: 1.2em;}#sk-container-id-2 div.sk-label-container {text-align: center;}#sk-container-id-2 div.sk-container {/* jupyter's `normalize.less` sets `[hidden] { display: none; }` but bootstrap.min.css set `[hidden] { display: none !important; }` so we also need the `!important` here to be able to override the default hidden behavior on the sphinx rendered scikit-learn.org. See: https://github.com/scikit-learn/scikit-learn/issues/21755 */display: inline-block !important;position: relative;}#sk-container-id-2 div.sk-text-repr-fallback {display: none;}</style><div id="sk-container-id-2" class="sk-top-container"><div class="sk-text-repr-fallback"><pre>LogisticRegression()</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class="sk-container" hidden><div class="sk-item"><div class="sk-estimator sk-toggleable"><input class="sk-toggleable__control sk-hidden--visually" id="sk-estimator-id-4" type="checkbox" checked><label for="sk-estimator-id-4" class="sk-toggleable__label sk-toggleable__label-arrow">LogisticRegression</label><div class="sk-toggleable__content"><pre>LogisticRegression()</pre></div></div></div></div></div>
|
||||
</div>
|
||||
|
|
@ -98,14 +105,14 @@ and we show the confusion matrix.</p>
|
|||
<span class="nb">print</span><span class="p">(</span><span class="n">confusion_matrix</span><span class="p">(</span><span class="n">y_test</span><span class="p">,</span> <span class="n">pred</span><span class="p">))</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[[ 9 0 0]
|
||||
[ 0 12 0]
|
||||
[ 0 1 16]]
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[[11 0 0]
|
||||
[ 0 15 0]
|
||||
[ 0 2 10]]
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="conversion-to-onnx-format">
|
||||
<h2><a class="toc-backref" href="#id2">Conversion to ONNX format</a><a class="headerlink" href="#conversion-to-onnx-format" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id2" role="doc-backlink">Conversion to ONNX format</a><a class="headerlink" href="#conversion-to-onnx-format" title="Permalink to this heading">¶</a></h2>
|
||||
<p>We use module
|
||||
<a class="reference external" href="https://github.com/onnx/sklearn-onnx">sklearn-onnx</a>
|
||||
to convert the model into ONNX format.</p>
|
||||
|
|
@ -142,15 +149,15 @@ output name='output_label' and shape=[None]
|
|||
<span class="nb">print</span><span class="p">(</span><span class="n">confusion_matrix</span><span class="p">(</span><span class="n">pred</span><span class="p">,</span> <span class="n">pred_onx</span><span class="p">))</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[[ 9 0 0]
|
||||
[ 0 13 0]
|
||||
[ 0 0 16]]
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[[11 0 0]
|
||||
[ 0 17 0]
|
||||
[ 0 0 10]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>The prediction are perfectly identical.</p>
|
||||
</section>
|
||||
<section id="probabilities">
|
||||
<h2><a class="toc-backref" href="#id3">Probabilities</a><a class="headerlink" href="#probabilities" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id3" role="doc-backlink">Probabilities</a><a class="headerlink" href="#probabilities" title="Permalink to this heading">¶</a></h2>
|
||||
<p>Probabilities are needed to compute other
|
||||
relevant metrics such as the ROC Curve.
|
||||
Let’s see how to get them first with
|
||||
|
|
@ -159,9 +166,9 @@ scikit-learn.</p>
|
|||
<span class="nb">print</span><span class="p">(</span><span class="n">prob_sklearn</span><span class="p">[:</span><span class="mi">3</span><span class="p">])</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[[9.74792469e-01 2.52074267e-02 1.04082095e-07]
|
||||
[2.04372454e-08 3.27727275e-03 9.96722707e-01]
|
||||
[3.58622821e-01 6.39558909e-01 1.81826980e-03]]
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[[2.51652941e-02 9.51347879e-01 2.34868266e-02]
|
||||
[4.19825782e-02 8.96096750e-01 6.19206722e-02]
|
||||
[1.35280393e-04 6.31904868e-02 9.36674233e-01]]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>And then with ONNX Runtime.
|
||||
|
|
@ -174,9 +181,9 @@ The probabilies appear to be</p>
|
|||
<span class="n">pprint</span><span class="o">.</span><span class="n">pprint</span><span class="p">(</span><span class="n">prob_rt</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">3</span><span class="p">])</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[{0: 0.97479248046875, 1: 0.02520740032196045, 2: 1.0408190576072229e-07},
|
||||
{0: 2.043722346911636e-08, 1: 0.0032772724516689777, 2: 0.9967227578163147},
|
||||
{0: 0.35862284898757935, 1: 0.6395589113235474, 2: 0.0018182684434577823}]
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>[{0: 0.02516530267894268, 1: 0.9513478875160217, 2: 0.02348681539297104},
|
||||
{0: 0.041982587426900864, 1: 0.8960967659950256, 2: 0.06192063167691231},
|
||||
{0: 0.00013528029376175255, 1: 0.06319047510623932, 2: 0.9366742372512817}]
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Let’s benchmark.</p>
|
||||
|
|
@ -200,11 +207,11 @@ The probabilies appear to be</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>Execution time for clr.predict
|
||||
Average 8.19e-05 min=7.17e-05 max=0.000104
|
||||
Average 5.2e-05 min=5.01e-05 max=6.67e-05
|
||||
Execution time for ONNX Runtime
|
||||
Average 3.77e-05 min=3.46e-05 max=4.94e-05
|
||||
Average 3.26e-05 min=2.88e-05 max=4.42e-05
|
||||
|
||||
3.7683185000219054e-05
|
||||
3.260208500009298e-05
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Let’s benchmark a scenario similar to what a webservice
|
||||
|
|
@ -232,11 +239,11 @@ as opposed to a batch of prediction.</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>Execution time for clr.predict
|
||||
Average 0.00675 min=0.00645 max=0.00818
|
||||
Average 0.00474 min=0.00472 max=0.0048
|
||||
Execution time for sess_predict
|
||||
Average 0.00192 min=0.00178 max=0.0025
|
||||
Average 0.00124 min=0.00122 max=0.00128
|
||||
|
||||
0.0019168183650000968
|
||||
0.0012437381899999878
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Let’s do the same for the probabilities.</p>
|
||||
|
|
@ -253,11 +260,11 @@ Average 0.00192 min=0.00178 max=0.0025
|
|||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>Execution time for predict_proba
|
||||
Average 0.00959 min=0.00917 max=0.0106
|
||||
Average 0.00697 min=0.00695 max=0.00706
|
||||
Execution time for sess_predict_proba
|
||||
Average 0.00197 min=0.00189 max=0.00221
|
||||
Average 0.0013 min=0.00129 max=0.00132
|
||||
|
||||
0.001971747110000308
|
||||
0.0013020304249994296
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>This second comparison is better as
|
||||
|
|
@ -266,7 +273,7 @@ computes the label and the probabilities
|
|||
in every case.</p>
|
||||
</section>
|
||||
<section id="benchmark-with-randomforest">
|
||||
<h2><a class="toc-backref" href="#id4">Benchmark with RandomForest</a><a class="headerlink" href="#benchmark-with-randomforest" title="Permalink to this heading">¶</a></h2>
|
||||
<h2><a class="toc-backref" href="#id4" role="doc-backlink">Benchmark with RandomForest</a><a class="headerlink" href="#benchmark-with-randomforest" title="Permalink to this heading">¶</a></h2>
|
||||
<p>We first train and save a model in ONNX format.</p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">sklearn.ensemble</span> <span class="kn">import</span> <span class="n">RandomForestClassifier</span>
|
||||
|
||||
|
|
@ -295,11 +302,11 @@ in every case.</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>Execution time for predict_proba
|
||||
Average 1.14 min=1.12 max=1.18
|
||||
Average 0.806 min=0.802 max=0.813
|
||||
Execution time for sess_predict_proba
|
||||
Average 0.00248 min=0.00229 max=0.00335
|
||||
Average 0.00166 min=0.00163 max=0.00172
|
||||
|
||||
0.002478402585000481
|
||||
0.0016625346749998473
|
||||
</pre></div>
|
||||
</div>
|
||||
<p>Let’s see with different number of trees.</p>
|
||||
|
|
@ -334,40 +341,40 @@ Average 0.00248 min=0.00229 max=0.00335
|
|||
</pre></div>
|
||||
</div>
|
||||
<img src="../images/sphx_glr_plot_train_convert_predict_001.png" srcset="../images/sphx_glr_plot_train_convert_predict_001.png" alt="Speed comparison between scikit-learn and ONNX Runtime For a random forest on Iris dataset" class = "sphx-glr-single-img"/><div class="sphx-glr-script-out highlight-none notranslate"><div class="highlight"><pre><span></span>5
|
||||
Average 0.0958 min=0.0905 max=0.105
|
||||
Average 0.0017 min=0.0016 max=0.00179
|
||||
Average 0.0661 min=0.0649 max=0.0702
|
||||
Average 0.00122 min=0.00121 max=0.00125
|
||||
10
|
||||
Average 0.149 min=0.147 max=0.15
|
||||
Average 0.00171 min=0.00159 max=0.0018
|
||||
Average 0.105 min=0.104 max=0.107
|
||||
Average 0.00125 min=0.00123 max=0.0013
|
||||
15
|
||||
Average 0.196 min=0.193 max=0.198
|
||||
Average 0.00172 min=0.00162 max=0.00182
|
||||
Average 0.142 min=0.142 max=0.142
|
||||
Average 0.00124 min=0.00124 max=0.00127
|
||||
20
|
||||
Average 0.246 min=0.243 max=0.248
|
||||
Average 0.00178 min=0.00167 max=0.00193
|
||||
Average 0.181 min=0.181 max=0.181
|
||||
Average 0.00126 min=0.00125 max=0.00129
|
||||
25
|
||||
Average 0.318 min=0.313 max=0.323
|
||||
Average 0.00184 min=0.00173 max=0.00193
|
||||
Average 0.221 min=0.22 max=0.223
|
||||
Average 0.00129 min=0.00128 max=0.00132
|
||||
30
|
||||
Average 0.358 min=0.352 max=0.364
|
||||
Average 0.00185 min=0.00177 max=0.0019
|
||||
Average 0.259 min=0.259 max=0.259
|
||||
Average 0.00129 min=0.00128 max=0.00133
|
||||
35
|
||||
Average 0.408 min=0.405 max=0.411
|
||||
Average 0.00196 min=0.00187 max=0.00221
|
||||
Average 0.301 min=0.298 max=0.305
|
||||
Average 0.00133 min=0.00132 max=0.00136
|
||||
40
|
||||
Average 0.481 min=0.477 max=0.484
|
||||
Average 0.00196 min=0.00191 max=0.002
|
||||
Average 0.336 min=0.335 max=0.336
|
||||
Average 0.00134 min=0.00132 max=0.00136
|
||||
45
|
||||
Average 0.536 min=0.524 max=0.547
|
||||
Average 0.00197 min=0.00191 max=0.00207
|
||||
Average 0.378 min=0.376 max=0.381
|
||||
Average 0.00135 min=0.00133 max=0.00139
|
||||
50
|
||||
Average 0.565 min=0.562 max=0.571
|
||||
Average 0.00203 min=0.00195 max=0.00217
|
||||
Average 0.414 min=0.414 max=0.416
|
||||
Average 0.00136 min=0.00134 max=0.0014
|
||||
|
||||
<matplotlib.legend.Legend object at 0x7f3f3bce87c0>
|
||||
<matplotlib.legend.Legend object at 0x7f2b3cb88ee0>
|
||||
</pre></div>
|
||||
</div>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 5 minutes 17.899 seconds)</p>
|
||||
<p class="sphx-glr-timing"><strong>Total running time of the script:</strong> ( 3 minutes 46.170 seconds)</p>
|
||||
<div class="sphx-glr-footer sphx-glr-footer-example docutils container" id="sphx-glr-download-auto-examples-plot-train-convert-predict-py">
|
||||
<div class="sphx-glr-download sphx-glr-download-python docutils container">
|
||||
<p><a class="reference download internal" download="" href="../downloads/c647c128e0cf2b3db04ce60b41ef1a14/plot_train_convert_predict.py"><code class="xref download docutils literal notranslate"><span class="pre">Download</span> <span class="pre">Python</span> <span class="pre">source</span> <span class="pre">code:</span> <span class="pre">plot_train_convert_predict.py</span></code></a></p>
|
||||
|
|
@ -442,8 +449,8 @@ Average 0.00203 min=0.00195 max=0.00217
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/plot_train_convert_predict.rst.txt"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -49,46 +46,41 @@
|
|||
|
||||
<section id="computation-times">
|
||||
<span id="sphx-glr-auto-examples-sg-execution-times"></span><h1>Computation times<a class="headerlink" href="#computation-times" title="Permalink to this heading">¶</a></h1>
|
||||
<p><strong>05:19.660</strong> total execution time for <strong>auto_examples</strong> files:</p>
|
||||
<p><strong>03:47.900</strong> total execution time for <strong>auto_examples</strong> files:</p>
|
||||
<table class="docutils align-default">
|
||||
<colgroup>
|
||||
<col style="width: 85%" />
|
||||
<col style="width: 9%" />
|
||||
<col style="width: 6%" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="plot_train_convert_predict.html#sphx-glr-auto-examples-plot-train-convert-predict-py"><span class="std std-ref">Train, convert and predict with ONNX Runtime</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_train_convert_predict.py</span></code>)</p></td>
|
||||
<td><p>05:17.899</p></td>
|
||||
<td><p>03:46.170</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="plot_convert_pipeline_vectorizer.html#sphx-glr-auto-examples-plot-convert-pipeline-vectorizer-py"><span class="std std-ref">Train, convert and predict with ONNX Runtime</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_convert_pipeline_vectorizer.py</span></code>)</p></td>
|
||||
<td><p>00:01.374</p></td>
|
||||
<td><p>00:01.392</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="plot_pipeline.html#sphx-glr-auto-examples-plot-pipeline-py"><span class="std std-ref">Draw a pipeline</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_pipeline.py</span></code>)</p></td>
|
||||
<td><p>00:00.322</p></td>
|
||||
<td><p>00:00.290</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="plot_backend.html#sphx-glr-auto-examples-plot-backend-py"><span class="std std-ref">ONNX Runtime Backend for ONNX</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_backend.py</span></code>)</p></td>
|
||||
<td><p>00:00.021</p></td>
|
||||
<td><p>00:00.019</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="plot_common_errors.html#sphx-glr-auto-examples-plot-common-errors-py"><span class="std std-ref">Common errors with onnxruntime</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_common_errors.py</span></code>)</p></td>
|
||||
<td><p>00:00.014</p></td>
|
||||
<td><p>00:00.011</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="plot_load_and_predict.html#sphx-glr-auto-examples-plot-load-and-predict-py"><span class="std std-ref">Load and predict with ONNX Runtime and a very simple model</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_load_and_predict.py</span></code>)</p></td>
|
||||
<td><p>00:00.013</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="plot_metadata.html#sphx-glr-auto-examples-plot-metadata-py"><span class="std std-ref">Metadata</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_metadata.py</span></code>)</p></td>
|
||||
<td><p>00:00.010</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="plot_profiling.html#sphx-glr-auto-examples-plot-profiling-py"><span class="std std-ref">Profile the execution of a simple model</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_profiling.py</span></code>)</p></td>
|
||||
<td><p>00:00.007</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-odd"><td><p><a class="reference internal" href="plot_profiling.html#sphx-glr-auto-examples-plot-profiling-py"><span class="std std-ref">Profile the execution of a simple model</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_profiling.py</span></code>)</p></td>
|
||||
<td><p>00:00.007</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
<tr class="row-even"><td><p><a class="reference internal" href="plot_metadata.html#sphx-glr-auto-examples-plot-metadata-py"><span class="std std-ref">Metadata</span></a> (<code class="docutils literal notranslate"><span class="pre">plot_metadata.py</span></code>)</p></td>
|
||||
<td><p>00:00.004</p></td>
|
||||
<td><p>0.0 MB</p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
|
@ -152,8 +144,8 @@
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="../sources/auto_examples/sg_execution_times.rst.txt"
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="static/documentation_options.js"></script>
|
||||
<script src="static/jquery.js"></script>
|
||||
<script src="static/underscore.js"></script>
|
||||
<script src="static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="static/doctools.js"></script>
|
||||
<script src="static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
|
|
@ -107,8 +104,8 @@
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="sources/examples_md.rst.txt"
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="static/documentation_options.js"></script>
|
||||
<script src="static/jquery.js"></script>
|
||||
<script src="static/underscore.js"></script>
|
||||
<script src="static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="static/doctools.js"></script>
|
||||
<script src="static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="#" />
|
||||
|
|
@ -497,8 +494,8 @@
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="static/documentation_options.js"></script>
|
||||
<script src="static/jquery.js"></script>
|
||||
<script src="static/underscore.js"></script>
|
||||
<script src="static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="static/doctools.js"></script>
|
||||
<script src="static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
|
|
@ -121,8 +118,8 @@ For more information on ONNX Runtime, please see <a class="reference external" h
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="sources/index.rst.txt"
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../static/documentation_options.js"></script>
|
||||
<script src="../static/jquery.js"></script>
|
||||
<script src="../static/underscore.js"></script>
|
||||
<script src="../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../static/doctools.js"></script>
|
||||
<script src="../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
|
|
@ -47,7 +44,8 @@
|
|||
<div class="body" role="main">
|
||||
|
||||
<h1>All modules for which code is available</h1>
|
||||
<ul><li><a href="onnxruntime/capi/onnxruntime_inference_collection.html">onnxruntime.capi.onnxruntime_inference_collection</a></li>
|
||||
<ul><li><a href="onnxruntime/backend/backend.html">onnxruntime.backend.backend</a></li>
|
||||
<li><a href="onnxruntime/capi/onnxruntime_inference_collection.html">onnxruntime.capi.onnxruntime_inference_collection</a></li>
|
||||
<li><a href="onnxruntime/capi/onnxruntime_pybind11_state.html">onnxruntime.capi.onnxruntime_pybind11_state</a></li>
|
||||
</ul>
|
||||
|
||||
|
|
@ -109,8 +107,8 @@
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="../../../static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../../../static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="../../../" id="documentation_options" src="../../../static/documentation_options.js"></script>
|
||||
<script src="../../../static/jquery.js"></script>
|
||||
<script src="../../../static/underscore.js"></script>
|
||||
<script src="../../../static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="../../../static/doctools.js"></script>
|
||||
<script src="../../../static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="../../../genindex.html" />
|
||||
|
|
@ -71,7 +68,7 @@
|
|||
|
||||
|
||||
<span class="k">def</span> <span class="nf">check_and_normalize_provider_args</span><span class="p">(</span><span class="n">providers</span><span class="p">,</span> <span class="n">provider_options</span><span class="p">,</span> <span class="n">available_provider_names</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Validates the 'providers' and 'provider_options' arguments and returns a</span>
|
||||
<span class="sd"> normalized version.</span>
|
||||
|
||||
|
|
@ -149,7 +146,7 @@
|
|||
|
||||
|
||||
<span class="k">class</span> <span class="nc">Session</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> This is the main class used to run a model.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
|
|
@ -188,7 +185,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_provider_options</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">set_providers</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">providers</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">provider_options</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Register the input list of execution providers. The underlying session is re-created.</span>
|
||||
|
||||
<span class="sd"> :param providers: Optional sequence of providers in order of decreasing</span>
|
||||
|
|
@ -210,13 +207,13 @@
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">_reset_session</span><span class="p">(</span><span class="n">providers</span><span class="p">,</span> <span class="n">provider_options</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">disable_fallback</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Disable session.run() fallback mechanism.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_enable_fallback</span> <span class="o">=</span> <span class="kc">False</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">enable_fallback</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Enable session.Run() fallback mechanism. If session.Run() fails due to an internal Execution Provider failure,</span>
|
||||
<span class="sd"> reset the Execution Providers enabled for this session.</span>
|
||||
<span class="sd"> If GPU is enabled, fall back to CUDAExecutionProvider.</span>
|
||||
|
|
@ -225,7 +222,7 @@
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">_enable_fallback</span> <span class="o">=</span> <span class="kc">True</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output_names</span><span class="p">,</span> <span class="n">input_feed</span><span class="p">,</span> <span class="n">run_options</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Compute the predictions.</span>
|
||||
|
||||
<span class="sd"> :param output_names: name of the outputs</span>
|
||||
|
|
@ -259,7 +256,7 @@
|
|||
<span class="k">raise</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">run_with_ort_values</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">output_names</span><span class="p">,</span> <span class="n">input_dict_ort_values</span><span class="p">,</span> <span class="n">run_options</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Compute the predictions.</span>
|
||||
|
||||
<span class="sd"> :param output_names: name of the outputs</span>
|
||||
|
|
@ -305,7 +302,7 @@
|
|||
<span class="k">raise</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">end_profiling</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> End profiling and return results in a file.</span>
|
||||
|
||||
<span class="sd"> The results are stored in a filename if the option</span>
|
||||
|
|
@ -314,7 +311,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sess</span><span class="o">.</span><span class="n">end_profiling</span><span class="p">()</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">get_profiling_start_time_ns</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Return the nanoseconds of profiling's start time</span>
|
||||
<span class="sd"> Comparable to time.monotonic_ns() after Python 3.3</span>
|
||||
<span class="sd"> On some platforms, this timer may not be as precise as nanoseconds</span>
|
||||
|
|
@ -327,7 +324,7 @@
|
|||
<span class="k">return</span> <span class="n">IOBinding</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">run_with_iobinding</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">iobinding</span><span class="p">,</span> <span class="n">run_options</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Compute the predictions.</span>
|
||||
|
||||
<span class="sd"> :param iobinding: the iobinding object that has graph inputs/outputs bind.</span>
|
||||
|
|
@ -336,7 +333,7 @@
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">_sess</span><span class="o">.</span><span class="n">run_with_iobinding</span><span class="p">(</span><span class="n">iobinding</span><span class="o">.</span><span class="n">_iobinding</span><span class="p">,</span> <span class="n">run_options</span><span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">run_with_ortvaluevector</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">run_options</span><span class="p">,</span> <span class="n">feed_names</span><span class="p">,</span> <span class="n">feeds</span><span class="p">,</span> <span class="n">fetch_names</span><span class="p">,</span> <span class="n">fetches</span><span class="p">,</span> <span class="n">fetch_devices</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Compute the predictions similar to other run_*() methods but with minimal C++/Python conversion overhead.</span>
|
||||
|
||||
<span class="sd"> :param run_options: See :class:`onnxruntime.RunOptions`.</span>
|
||||
|
|
@ -350,12 +347,12 @@
|
|||
|
||||
|
||||
<div class="viewcode-block" id="InferenceSession"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.InferenceSession">[docs]</a><span class="k">class</span> <span class="nc">InferenceSession</span><span class="p">(</span><span class="n">Session</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> This is the main class used to run a model.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">path_or_bytes</span><span class="p">,</span> <span class="n">sess_options</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">providers</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">provider_options</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> :param path_or_bytes: filename or serialized ONNX or ORT format model in a byte string</span>
|
||||
<span class="sd"> :param sess_options: session options</span>
|
||||
<span class="sd"> :param providers: Optional sequence of providers in order of decreasing</span>
|
||||
|
|
@ -486,7 +483,7 @@
|
|||
|
||||
|
||||
<div class="viewcode-block" id="IOBinding"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.IOBinding">[docs]</a><span class="k">class</span> <span class="nc">IOBinding</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> This class provides API to bind input/output to a specified device, e.g. GPU.</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
|
|
@ -495,7 +492,7 @@
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">_numpy_obj_references</span> <span class="o">=</span> <span class="p">{}</span>
|
||||
|
||||
<div class="viewcode-block" id="IOBinding.bind_cpu_input"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.IOBinding.bind_cpu_input">[docs]</a> <span class="k">def</span> <span class="nf">bind_cpu_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">arr_on_cpu</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> bind an input to array on CPU</span>
|
||||
<span class="sd"> :param name: input name</span>
|
||||
<span class="sd"> :param arr_on_cpu: input values as a python array on CPU</span>
|
||||
|
|
@ -507,7 +504,7 @@
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">_iobinding</span><span class="o">.</span><span class="n">bind_input</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="n">arr_on_cpu</span><span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="IOBinding.bind_input"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.IOBinding.bind_input">[docs]</a> <span class="k">def</span> <span class="nf">bind_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">device_type</span><span class="p">,</span> <span class="n">device_id</span><span class="p">,</span> <span class="n">element_type</span><span class="p">,</span> <span class="n">shape</span><span class="p">,</span> <span class="n">buffer_ptr</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> :param name: input name</span>
|
||||
<span class="sd"> :param device_type: e.g. cpu, cuda</span>
|
||||
<span class="sd"> :param device_id: device id, e.g. 0</span>
|
||||
|
|
@ -528,7 +525,7 @@
|
|||
<span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="IOBinding.bind_ortvalue_input"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.IOBinding.bind_ortvalue_input">[docs]</a> <span class="k">def</span> <span class="nf">bind_ortvalue_input</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">ortvalue</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> :param name: input name</span>
|
||||
<span class="sd"> :param ortvalue: OrtValue instance to bind</span>
|
||||
<span class="sd"> """</span>
|
||||
|
|
@ -546,7 +543,7 @@
|
|||
<span class="n">shape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="n">buffer_ptr</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span>
|
||||
<span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> :param name: output name</span>
|
||||
<span class="sd"> :param device_type: e.g. cpu, cuda, cpu by default</span>
|
||||
<span class="sd"> :param device_id: device id, e.g. 0</span>
|
||||
|
|
@ -586,7 +583,7 @@
|
|||
<span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="IOBinding.bind_ortvalue_output"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.IOBinding.bind_ortvalue_output">[docs]</a> <span class="k">def</span> <span class="nf">bind_ortvalue_output</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">ortvalue</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> :param name: output name</span>
|
||||
<span class="sd"> :param ortvalue: OrtValue instance to bind</span>
|
||||
<span class="sd"> """</span>
|
||||
|
|
@ -596,7 +593,7 @@
|
|||
<span class="bp">self</span><span class="o">.</span><span class="n">_iobinding</span><span class="o">.</span><span class="n">synchronize_outputs</span><span class="p">()</span>
|
||||
|
||||
<div class="viewcode-block" id="IOBinding.get_outputs"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.IOBinding.get_outputs">[docs]</a> <span class="k">def</span> <span class="nf">get_outputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns the output OrtValues from the Run() that preceded the call.</span>
|
||||
<span class="sd"> The data buffer of the obtained OrtValues may not reside on CPU memory</span>
|
||||
<span class="sd"> """</span>
|
||||
|
|
@ -609,7 +606,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_iobinding</span><span class="o">.</span><span class="n">get_outputs</span><span class="p">()</span>
|
||||
|
||||
<div class="viewcode-block" id="IOBinding.copy_outputs_to_cpu"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.IOBinding.copy_outputs_to_cpu">[docs]</a> <span class="k">def</span> <span class="nf">copy_outputs_to_cpu</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""Copy output contents to CPU (if on another device). No-op if already on the CPU."""</span>
|
||||
<span class="w"> </span><span class="sd">"""Copy output contents to CPU (if on another device). No-op if already on the CPU."""</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_iobinding</span><span class="o">.</span><span class="n">copy_outputs_to_cpu</span><span class="p">()</span></div>
|
||||
|
||||
<span class="k">def</span> <span class="nf">clear_binding_inputs</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
|
|
@ -620,7 +617,7 @@
|
|||
|
||||
|
||||
<div class="viewcode-block" id="OrtValue"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue">[docs]</a><span class="k">class</span> <span class="nc">OrtValue</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> A data structure that supports all ONNX data formats (tensors and non-tensors) that allows users</span>
|
||||
<span class="sd"> to place the data backing these on a device, for example, on a CUDA supported device.</span>
|
||||
<span class="sd"> This class provides APIs to construct and deal with OrtValues.</span>
|
||||
|
|
@ -643,7 +640,7 @@
|
|||
|
||||
<div class="viewcode-block" id="OrtValue.ortvalue_from_numpy"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.ortvalue_from_numpy">[docs]</a> <span class="nd">@staticmethod</span>
|
||||
<span class="k">def</span> <span class="nf">ortvalue_from_numpy</span><span class="p">(</span><span class="n">numpy_obj</span><span class="p">,</span> <span class="n">device_type</span><span class="o">=</span><span class="s2">"cpu"</span><span class="p">,</span> <span class="n">device_id</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Factory method to construct an OrtValue (which holds a Tensor) from a given Numpy object</span>
|
||||
<span class="sd"> A copy of the data in the Numpy object is held by the OrtValue only if the device is NOT cpu</span>
|
||||
|
||||
|
|
@ -668,7 +665,7 @@
|
|||
|
||||
<div class="viewcode-block" id="OrtValue.ortvalue_from_shape_and_type"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.ortvalue_from_shape_and_type">[docs]</a> <span class="nd">@staticmethod</span>
|
||||
<span class="k">def</span> <span class="nf">ortvalue_from_shape_and_type</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">element_type</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">device_type</span><span class="o">=</span><span class="s2">"cpu"</span><span class="p">,</span> <span class="n">device_id</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Factory method to construct an OrtValue (which holds a Tensor) from given shape and element_type</span>
|
||||
|
||||
<span class="sd"> :param shape: List of integers indicating the shape of the OrtValue</span>
|
||||
|
|
@ -693,76 +690,76 @@
|
|||
|
||||
<div class="viewcode-block" id="OrtValue.ort_value_from_sparse_tensor"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.ort_value_from_sparse_tensor">[docs]</a> <span class="nd">@staticmethod</span>
|
||||
<span class="k">def</span> <span class="nf">ort_value_from_sparse_tensor</span><span class="p">(</span><span class="n">sparse_tensor</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> The function will construct an OrtValue instance from a valid SparseTensor</span>
|
||||
<span class="sd"> The new instance of OrtValue will assume the ownership of sparse_tensor</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">OrtValue</span><span class="p">(</span><span class="n">C</span><span class="o">.</span><span class="n">OrtValue</span><span class="o">.</span><span class="n">ort_value_from_sparse_tensor</span><span class="p">(</span><span class="n">sparse_tensor</span><span class="o">.</span><span class="n">_get_c_tensor</span><span class="p">()))</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.as_sparse_tensor"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.as_sparse_tensor">[docs]</a> <span class="k">def</span> <span class="nf">as_sparse_tensor</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> The function will return SparseTensor contained in this OrtValue</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">SparseTensor</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">as_sparse_tensor</span><span class="p">())</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.data_ptr"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.data_ptr">[docs]</a> <span class="k">def</span> <span class="nf">data_ptr</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns the address of the first element in the OrtValue's data buffer</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">data_ptr</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.device_name"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.device_name">[docs]</a> <span class="k">def</span> <span class="nf">device_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns the name of the device where the OrtValue's data buffer resides e.g. cpu, cuda</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">device_name</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.shape"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.shape">[docs]</a> <span class="k">def</span> <span class="nf">shape</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns the shape of the data in the OrtValue</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">shape</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.data_type"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.data_type">[docs]</a> <span class="k">def</span> <span class="nf">data_type</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns the data type of the data in the OrtValue</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">data_type</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.element_type"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.element_type">[docs]</a> <span class="k">def</span> <span class="nf">element_type</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns the proto type of the data in the OrtValue</span>
|
||||
<span class="sd"> if the OrtValue is a tensor.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">element_type</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.has_value"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.has_value">[docs]</a> <span class="k">def</span> <span class="nf">has_value</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns True if the OrtValue corresponding to an</span>
|
||||
<span class="sd"> optional type contains data, else returns False</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">has_value</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.is_tensor"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.is_tensor">[docs]</a> <span class="k">def</span> <span class="nf">is_tensor</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns True if the OrtValue contains a Tensor, else returns False</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">is_tensor</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.is_sparse_tensor"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.is_sparse_tensor">[docs]</a> <span class="k">def</span> <span class="nf">is_sparse_tensor</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns True if the OrtValue contains a SparseTensor, else returns False</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">is_sparse_tensor</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.is_tensor_sequence"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.is_tensor_sequence">[docs]</a> <span class="k">def</span> <span class="nf">is_tensor_sequence</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns True if the OrtValue contains a Tensor Sequence, else returns False</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">is_tensor_sequence</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.numpy"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.numpy">[docs]</a> <span class="k">def</span> <span class="nf">numpy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns a Numpy object from the OrtValue.</span>
|
||||
<span class="sd"> Valid only for OrtValues holding Tensors. Throws for OrtValues holding non-Tensors.</span>
|
||||
<span class="sd"> Use accessors to gain a reference to non-Tensor objects such as SparseTensor</span>
|
||||
|
|
@ -770,7 +767,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ortvalue</span><span class="o">.</span><span class="n">numpy</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="OrtValue.update_inplace"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtValue.update_inplace">[docs]</a> <span class="k">def</span> <span class="nf">update_inplace</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">np_arr</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Update the OrtValue in place with a new Numpy array. The numpy contents</span>
|
||||
<span class="sd"> are copied over to the device memory backing the OrtValue. It can be used</span>
|
||||
<span class="sd"> to update the input valuess for an InferenceSession with CUDA graph</span>
|
||||
|
|
@ -781,12 +778,12 @@
|
|||
|
||||
|
||||
<div class="viewcode-block" id="OrtDevice"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.OrtDevice">[docs]</a><span class="k">class</span> <span class="nc">OrtDevice</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> A data structure that exposes the underlying C++ OrtDevice</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">c_ort_device</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Internal constructor</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">c_ort_device</span><span class="p">,</span> <span class="n">C</span><span class="o">.</span><span class="n">OrtDevice</span><span class="p">):</span>
|
||||
|
|
@ -797,7 +794,7 @@
|
|||
<span class="p">)</span>
|
||||
|
||||
<span class="k">def</span> <span class="nf">_get_c_device</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Internal accessor to underlying object</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_ort_device</span>
|
||||
|
|
@ -820,7 +817,7 @@
|
|||
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor">[docs]</a><span class="k">class</span> <span class="nc">SparseTensor</span><span class="p">:</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> A data structure that project the C++ SparseTensor object</span>
|
||||
<span class="sd"> The class provides API to work with the object.</span>
|
||||
<span class="sd"> Depending on the format, the class will hold more than one buffer</span>
|
||||
|
|
@ -828,7 +825,7 @@
|
|||
<span class="sd"> """</span>
|
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sparse_tensor</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Internal constructor</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">sparse_tensor</span><span class="p">,</span> <span class="n">C</span><span class="o">.</span><span class="n">SparseTensor</span><span class="p">):</span>
|
||||
|
|
@ -844,7 +841,7 @@
|
|||
|
||||
<div class="viewcode-block" id="SparseTensor.sparse_coo_from_numpy"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.sparse_coo_from_numpy">[docs]</a> <span class="nd">@staticmethod</span>
|
||||
<span class="k">def</span> <span class="nf">sparse_coo_from_numpy</span><span class="p">(</span><span class="n">dense_shape</span><span class="p">,</span> <span class="n">values</span><span class="p">,</span> <span class="n">coo_indices</span><span class="p">,</span> <span class="n">ort_device</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Factory method to construct a SparseTensor in COO format from given arguments</span>
|
||||
|
||||
<span class="sd"> :param dense_shape: 1-D numpy array(int64) or a python list that contains a dense_shape of the sparse tensor</span>
|
||||
|
|
@ -870,7 +867,7 @@
|
|||
|
||||
<div class="viewcode-block" id="SparseTensor.sparse_csr_from_numpy"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.sparse_csr_from_numpy">[docs]</a> <span class="nd">@staticmethod</span>
|
||||
<span class="k">def</span> <span class="nf">sparse_csr_from_numpy</span><span class="p">(</span><span class="n">dense_shape</span><span class="p">,</span> <span class="n">values</span><span class="p">,</span> <span class="n">inner_indices</span><span class="p">,</span> <span class="n">outer_indices</span><span class="p">,</span> <span class="n">ort_device</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Factory method to construct a SparseTensor in CSR format from given arguments</span>
|
||||
|
||||
<span class="sd"> :param dense_shape: 1-D numpy array(int64) or a python list that contains a dense_shape of the</span>
|
||||
|
|
@ -901,7 +898,7 @@
|
|||
<span class="p">)</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.values"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.values">[docs]</a> <span class="k">def</span> <span class="nf">values</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> The method returns a numpy array that is backed by the native memory</span>
|
||||
<span class="sd"> if the data type is numeric. Otherwise, the returned numpy array that contains</span>
|
||||
<span class="sd"> copies of the strings.</span>
|
||||
|
|
@ -909,7 +906,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">values</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.as_coo_view"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.as_coo_view">[docs]</a> <span class="k">def</span> <span class="nf">as_coo_view</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> The method will return coo representation of the sparse tensor which will enable</span>
|
||||
<span class="sd"> querying COO indices. If the instance did not contain COO format, it would throw.</span>
|
||||
<span class="sd"> You can query coo indices as:</span>
|
||||
|
|
@ -923,7 +920,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">get_coo_data</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.as_csrc_view"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.as_csrc_view">[docs]</a> <span class="k">def</span> <span class="nf">as_csrc_view</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> The method will return CSR(C) representation of the sparse tensor which will enable</span>
|
||||
<span class="sd"> querying CRS(C) indices. If the instance dit not contain CSR(C) format, it would throw.</span>
|
||||
<span class="sd"> You can query indices as:</span>
|
||||
|
|
@ -938,7 +935,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">get_csrc_data</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.as_blocksparse_view"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.as_blocksparse_view">[docs]</a> <span class="k">def</span> <span class="nf">as_blocksparse_view</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> The method will return coo representation of the sparse tensor which will enable</span>
|
||||
<span class="sd"> querying BlockSparse indices. If the instance did not contain BlockSparse format, it would throw.</span>
|
||||
<span class="sd"> You can query coo indices as:</span>
|
||||
|
|
@ -952,7 +949,7 @@
|
|||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">get_blocksparse_data</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.to_cuda"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.to_cuda">[docs]</a> <span class="k">def</span> <span class="nf">to_cuda</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ort_device</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns a copy of this instance on the specified cuda device</span>
|
||||
|
||||
<span class="sd"> :param ort_device: with name 'cuda' and valid gpu device id</span>
|
||||
|
|
@ -967,25 +964,25 @@
|
|||
<span class="k">return</span> <span class="n">SparseTensor</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">to_cuda</span><span class="p">(</span><span class="n">ort_device</span><span class="o">.</span><span class="n">_get_c_device</span><span class="p">()))</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.format"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.format">[docs]</a> <span class="k">def</span> <span class="nf">format</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns a OrtSparseFormat enumeration</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">format</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.dense_shape"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.dense_shape">[docs]</a> <span class="k">def</span> <span class="nf">dense_shape</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns a numpy array(int64) containing a dense shape of a sparse tensor</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">dense_shape</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.data_type"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.data_type">[docs]</a> <span class="k">def</span> <span class="nf">data_type</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns a string data type of the data in the OrtValue</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">data_type</span><span class="p">()</span></div>
|
||||
|
||||
<div class="viewcode-block" id="SparseTensor.device_name"><a class="viewcode-back" href="../../../api_summary.html#onnxruntime.SparseTensor.device_name">[docs]</a> <span class="k">def</span> <span class="nf">device_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="w"> </span><span class="sd">"""</span>
|
||||
<span class="sd"> Returns the name of the device where the SparseTensor data buffers reside e.g. cpu, cuda</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_tensor</span><span class="o">.</span><span class="n">device_name</span><span class="p">()</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span></div></div>
|
||||
|
|
@ -1051,8 +1048,8 @@
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-rendered-html.css" />
|
||||
|
||||
<script data-url_root="./" id="documentation_options" src="static/documentation_options.js"></script>
|
||||
<script src="static/jquery.js"></script>
|
||||
<script src="static/underscore.js"></script>
|
||||
<script src="static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="static/doctools.js"></script>
|
||||
<script src="static/sphinx_highlight.js"></script>
|
||||
<script src="static/searchtools.js"></script>
|
||||
|
|
@ -131,8 +128,8 @@
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
</div>
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -129,7 +129,7 @@ with the same API.
|
|||
|
||||
.. rst-class:: sphx-glr-timing
|
||||
|
||||
**Total running time of the script:** ( 0 minutes 0.021 seconds)
|
||||
**Total running time of the script:** ( 0 minutes 0.019 seconds)
|
||||
|
||||
|
||||
.. _sphx_glr_download_auto_examples_plot_backend.py:
|
||||
|
|
|
|||
|
|
@ -291,7 +291,7 @@ is higher than expects but produces a warning.
|
|||
|
||||
.. rst-class:: sphx-glr-timing
|
||||
|
||||
**Total running time of the script:** ( 0 minutes 0.014 seconds)
|
||||
**Total running time of the script:** ( 0 minutes 0.011 seconds)
|
||||
|
||||
|
||||
.. _sphx_glr_download_auto_examples_plot_common_errors.py:
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ and we show the confusion matrix.
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
0.8474132062469484
|
||||
0.92310182911155
|
||||
|
||||
|
||||
|
||||
|
|
@ -284,7 +284,7 @@ We compare them to the model's ones.
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
0.9999999999999123
|
||||
0.9999999999999366
|
||||
|
||||
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ that explains the small discrepencies.
|
|||
|
||||
.. rst-class:: sphx-glr-timing
|
||||
|
||||
**Total running time of the script:** ( 0 minutes 1.374 seconds)
|
||||
**Total running time of the script:** ( 0 minutes 1.392 seconds)
|
||||
|
||||
|
||||
.. _sphx_glr_download_auto_examples_plot_convert_pipeline_vectorizer.py:
|
||||
|
|
|
|||
|
|
@ -149,20 +149,20 @@ Let's compute its outputs (or predictions if it is a machine learned model).
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
[array([[[0.72821426, 0.6339202 , 0.7272735 , 0.6409311 , 0.61518466],
|
||||
[0.7185246 , 0.640914 , 0.60131776, 0.6857518 , 0.70039463],
|
||||
[0.7135308 , 0.65056884, 0.58760184, 0.7135416 , 0.63284004],
|
||||
[0.7188247 , 0.5470599 , 0.58532 , 0.67812634, 0.6893187 ]],
|
||||
[array([[[0.6741172 , 0.7219819 , 0.61369073, 0.7058611 , 0.6851099 ],
|
||||
[0.65471834, 0.59070265, 0.6932085 , 0.58628637, 0.68116176],
|
||||
[0.6053132 , 0.6046966 , 0.5977106 , 0.5027518 , 0.6936471 ],
|
||||
[0.584405 , 0.5433203 , 0.71175635, 0.5528623 , 0.66580206]],
|
||||
|
||||
[[0.6211655 , 0.554035 , 0.55418974, 0.56652635, 0.62399405],
|
||||
[0.55780345, 0.6938668 , 0.5910147 , 0.59314 , 0.54391265],
|
||||
[0.7126377 , 0.65041703, 0.62936115, 0.69839984, 0.5651956 ],
|
||||
[0.6023196 , 0.6012137 , 0.7164181 , 0.59447944, 0.7121656 ]],
|
||||
[[0.54814535, 0.5123932 , 0.68307173, 0.72042155, 0.63475394],
|
||||
[0.64413285, 0.70860803, 0.6923877 , 0.5770614 , 0.53430355],
|
||||
[0.57739794, 0.6555867 , 0.6817992 , 0.6585449 , 0.593924 ],
|
||||
[0.64254063, 0.6924439 , 0.7242955 , 0.7274165 , 0.55333275]],
|
||||
|
||||
[[0.6137416 , 0.65805656, 0.6757898 , 0.7231871 , 0.6186665 ],
|
||||
[0.662174 , 0.61860013, 0.6509645 , 0.57368857, 0.689906 ],
|
||||
[0.7140595 , 0.7226651 , 0.6117408 , 0.5281206 , 0.69103116],
|
||||
[0.7082236 , 0.7197187 , 0.6111821 , 0.6187154 , 0.53502613]]],
|
||||
[[0.6204574 , 0.551248 , 0.54466 , 0.70989406, 0.5772743 ],
|
||||
[0.67696744, 0.5659738 , 0.6278838 , 0.51225674, 0.6547737 ],
|
||||
[0.6698583 , 0.527287 , 0.7128138 , 0.500769 , 0.6947695 ],
|
||||
[0.5108964 , 0.694841 , 0.50497264, 0.6312783 , 0.7083145 ]]],
|
||||
dtype=float32)]
|
||||
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ Let's compute its outputs (or predictions if it is a machine learned model).
|
|||
|
||||
.. rst-class:: sphx-glr-timing
|
||||
|
||||
**Total running time of the script:** ( 0 minutes 0.013 seconds)
|
||||
**Total running time of the script:** ( 0 minutes 0.007 seconds)
|
||||
|
||||
|
||||
.. _sphx_glr_download_auto_examples_plot_load_and_predict.py:
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ With *ONNX Runtime*:
|
|||
|
||||
.. rst-class:: sphx-glr-timing
|
||||
|
||||
**Total running time of the script:** ( 0 minutes 0.010 seconds)
|
||||
**Total running time of the script:** ( 0 minutes 0.004 seconds)
|
||||
|
||||
|
||||
.. _sphx_glr_download_auto_examples_plot_metadata.py:
|
||||
|
|
|
|||
|
|
@ -226,14 +226,14 @@ Which we display...
|
|||
.. code-block:: none
|
||||
|
||||
|
||||
<matplotlib.image.AxesImage object at 0x7f3f51301840>
|
||||
<matplotlib.image.AxesImage object at 0x7f2b5427f280>
|
||||
|
||||
|
||||
|
||||
|
||||
.. rst-class:: sphx-glr-timing
|
||||
|
||||
**Total running time of the script:** ( 0 minutes 0.322 seconds)
|
||||
**Total running time of the script:** ( 0 minutes 0.290 seconds)
|
||||
|
||||
|
||||
.. _sphx_glr_download_auto_examples_plot_pipeline.py:
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ before running the predictions.
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
onnxruntime_profile__2022-12-09_23-45-49.json
|
||||
onnxruntime_profile__2023-01-20_00-04-24.json
|
||||
|
||||
|
||||
|
||||
|
|
@ -148,20 +148,20 @@ Let's see what it contains.
|
|||
|
||||
[{'args': {},
|
||||
'cat': 'Session',
|
||||
'dur': 65,
|
||||
'dur': 83,
|
||||
'name': 'model_loading_array',
|
||||
'ph': 'X',
|
||||
'pid': 2734,
|
||||
'tid': 2734,
|
||||
'ts': 1},
|
||||
'pid': 2666,
|
||||
'tid': 2666,
|
||||
'ts': 2},
|
||||
{'args': {},
|
||||
'cat': 'Session',
|
||||
'dur': 329,
|
||||
'dur': 335,
|
||||
'name': 'session_initialization',
|
||||
'ph': 'X',
|
||||
'pid': 2734,
|
||||
'tid': 2734,
|
||||
'ts': 83}]
|
||||
'pid': 2666,
|
||||
'tid': 2666,
|
||||
'ts': 103}]
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -74,6 +74,19 @@ Then we fit a model.
|
|||
|
||||
|
||||
|
||||
.. rst-class:: sphx-glr-script-out
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
/home/runner/.local/lib/python3.10/site-packages/sklearn/linear_model/_logistic.py:444: ConvergenceWarning: lbfgs failed to converge (status=1):
|
||||
STOP: TOTAL NO. of ITERATIONS REACHED LIMIT.
|
||||
|
||||
Increase the number of iterations (max_iter) or scale the data as shown in:
|
||||
https://scikit-learn.org/stable/modules/preprocessing.html
|
||||
Please also refer to the documentation for alternative solver options:
|
||||
https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression
|
||||
n_iter_i = _check_optimize_result(
|
||||
|
||||
|
||||
.. raw:: html
|
||||
|
||||
|
|
@ -105,9 +118,9 @@ and we show the confusion matrix.
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
[[ 9 0 0]
|
||||
[ 0 12 0]
|
||||
[ 0 1 16]]
|
||||
[[11 0 0]
|
||||
[ 0 15 0]
|
||||
[ 0 2 10]]
|
||||
|
||||
|
||||
|
||||
|
|
@ -197,9 +210,9 @@ We compute the predictions.
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
[[ 9 0 0]
|
||||
[ 0 13 0]
|
||||
[ 0 0 16]]
|
||||
[[11 0 0]
|
||||
[ 0 17 0]
|
||||
[ 0 0 10]]
|
||||
|
||||
|
||||
|
||||
|
|
@ -232,9 +245,9 @@ scikit-learn.
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
[[9.74792469e-01 2.52074267e-02 1.04082095e-07]
|
||||
[2.04372454e-08 3.27727275e-03 9.96722707e-01]
|
||||
[3.58622821e-01 6.39558909e-01 1.81826980e-03]]
|
||||
[[2.51652941e-02 9.51347879e-01 2.34868266e-02]
|
||||
[4.19825782e-02 8.96096750e-01 6.19206722e-02]
|
||||
[1.35280393e-04 6.31904868e-02 9.36674233e-01]]
|
||||
|
||||
|
||||
|
||||
|
|
@ -264,9 +277,9 @@ The probabilies appear to be
|
|||
|
||||
.. code-block:: none
|
||||
|
||||
[{0: 0.97479248046875, 1: 0.02520740032196045, 2: 1.0408190576072229e-07},
|
||||
{0: 2.043722346911636e-08, 1: 0.0032772724516689777, 2: 0.9967227578163147},
|
||||
{0: 0.35862284898757935, 1: 0.6395589113235474, 2: 0.0018182684434577823}]
|
||||
[{0: 0.02516530267894268, 1: 0.9513478875160217, 2: 0.02348681539297104},
|
||||
{0: 0.041982587426900864, 1: 0.8960967659950256, 2: 0.06192063167691231},
|
||||
{0: 0.00013528029376175255, 1: 0.06319047510623932, 2: 0.9366742372512817}]
|
||||
|
||||
|
||||
|
||||
|
|
@ -306,11 +319,11 @@ Let's benchmark.
|
|||
.. code-block:: none
|
||||
|
||||
Execution time for clr.predict
|
||||
Average 8.19e-05 min=7.17e-05 max=0.000104
|
||||
Average 5.2e-05 min=5.01e-05 max=6.67e-05
|
||||
Execution time for ONNX Runtime
|
||||
Average 3.77e-05 min=3.46e-05 max=4.94e-05
|
||||
Average 3.26e-05 min=2.88e-05 max=4.42e-05
|
||||
|
||||
3.7683185000219054e-05
|
||||
3.260208500009298e-05
|
||||
|
||||
|
||||
|
||||
|
|
@ -355,11 +368,11 @@ as opposed to a batch of prediction.
|
|||
.. code-block:: none
|
||||
|
||||
Execution time for clr.predict
|
||||
Average 0.00675 min=0.00645 max=0.00818
|
||||
Average 0.00474 min=0.00472 max=0.0048
|
||||
Execution time for sess_predict
|
||||
Average 0.00192 min=0.00178 max=0.0025
|
||||
Average 0.00124 min=0.00122 max=0.00128
|
||||
|
||||
0.0019168183650000968
|
||||
0.0012437381899999878
|
||||
|
||||
|
||||
|
||||
|
|
@ -392,11 +405,11 @@ Let's do the same for the probabilities.
|
|||
.. code-block:: none
|
||||
|
||||
Execution time for predict_proba
|
||||
Average 0.00959 min=0.00917 max=0.0106
|
||||
Average 0.00697 min=0.00695 max=0.00706
|
||||
Execution time for sess_predict_proba
|
||||
Average 0.00197 min=0.00189 max=0.00221
|
||||
Average 0.0013 min=0.00129 max=0.00132
|
||||
|
||||
0.001971747110000308
|
||||
0.0013020304249994296
|
||||
|
||||
|
||||
|
||||
|
|
@ -466,11 +479,11 @@ We compare.
|
|||
.. code-block:: none
|
||||
|
||||
Execution time for predict_proba
|
||||
Average 1.14 min=1.12 max=1.18
|
||||
Average 0.806 min=0.802 max=0.813
|
||||
Execution time for sess_predict_proba
|
||||
Average 0.00248 min=0.00229 max=0.00335
|
||||
Average 0.00166 min=0.00163 max=0.00172
|
||||
|
||||
0.002478402585000481
|
||||
0.0016625346749998473
|
||||
|
||||
|
||||
|
||||
|
|
@ -525,44 +538,44 @@ Let's see with different number of trees.
|
|||
.. code-block:: none
|
||||
|
||||
5
|
||||
Average 0.0958 min=0.0905 max=0.105
|
||||
Average 0.0017 min=0.0016 max=0.00179
|
||||
Average 0.0661 min=0.0649 max=0.0702
|
||||
Average 0.00122 min=0.00121 max=0.00125
|
||||
10
|
||||
Average 0.149 min=0.147 max=0.15
|
||||
Average 0.00171 min=0.00159 max=0.0018
|
||||
Average 0.105 min=0.104 max=0.107
|
||||
Average 0.00125 min=0.00123 max=0.0013
|
||||
15
|
||||
Average 0.196 min=0.193 max=0.198
|
||||
Average 0.00172 min=0.00162 max=0.00182
|
||||
Average 0.142 min=0.142 max=0.142
|
||||
Average 0.00124 min=0.00124 max=0.00127
|
||||
20
|
||||
Average 0.246 min=0.243 max=0.248
|
||||
Average 0.00178 min=0.00167 max=0.00193
|
||||
Average 0.181 min=0.181 max=0.181
|
||||
Average 0.00126 min=0.00125 max=0.00129
|
||||
25
|
||||
Average 0.318 min=0.313 max=0.323
|
||||
Average 0.00184 min=0.00173 max=0.00193
|
||||
Average 0.221 min=0.22 max=0.223
|
||||
Average 0.00129 min=0.00128 max=0.00132
|
||||
30
|
||||
Average 0.358 min=0.352 max=0.364
|
||||
Average 0.00185 min=0.00177 max=0.0019
|
||||
Average 0.259 min=0.259 max=0.259
|
||||
Average 0.00129 min=0.00128 max=0.00133
|
||||
35
|
||||
Average 0.408 min=0.405 max=0.411
|
||||
Average 0.00196 min=0.00187 max=0.00221
|
||||
Average 0.301 min=0.298 max=0.305
|
||||
Average 0.00133 min=0.00132 max=0.00136
|
||||
40
|
||||
Average 0.481 min=0.477 max=0.484
|
||||
Average 0.00196 min=0.00191 max=0.002
|
||||
Average 0.336 min=0.335 max=0.336
|
||||
Average 0.00134 min=0.00132 max=0.00136
|
||||
45
|
||||
Average 0.536 min=0.524 max=0.547
|
||||
Average 0.00197 min=0.00191 max=0.00207
|
||||
Average 0.378 min=0.376 max=0.381
|
||||
Average 0.00135 min=0.00133 max=0.00139
|
||||
50
|
||||
Average 0.565 min=0.562 max=0.571
|
||||
Average 0.00203 min=0.00195 max=0.00217
|
||||
Average 0.414 min=0.414 max=0.416
|
||||
Average 0.00136 min=0.00134 max=0.0014
|
||||
|
||||
<matplotlib.legend.Legend object at 0x7f3f3bce87c0>
|
||||
<matplotlib.legend.Legend object at 0x7f2b3cb88ee0>
|
||||
|
||||
|
||||
|
||||
|
||||
.. rst-class:: sphx-glr-timing
|
||||
|
||||
**Total running time of the script:** ( 5 minutes 17.899 seconds)
|
||||
**Total running time of the script:** ( 3 minutes 46.170 seconds)
|
||||
|
||||
|
||||
.. _sphx_glr_download_auto_examples_plot_train_convert_predict.py:
|
||||
|
|
|
|||
|
|
@ -5,22 +5,22 @@
|
|||
|
||||
Computation times
|
||||
=================
|
||||
**05:19.660** total execution time for **auto_examples** files:
|
||||
**03:47.900** total execution time for **auto_examples** files:
|
||||
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_train_convert_predict.py` (``plot_train_convert_predict.py``) | 05:17.899 | 0.0 MB |
|
||||
| :ref:`sphx_glr_auto_examples_plot_train_convert_predict.py` (``plot_train_convert_predict.py``) | 03:46.170 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_convert_pipeline_vectorizer.py` (``plot_convert_pipeline_vectorizer.py``) | 00:01.374 | 0.0 MB |
|
||||
| :ref:`sphx_glr_auto_examples_plot_convert_pipeline_vectorizer.py` (``plot_convert_pipeline_vectorizer.py``) | 00:01.392 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_pipeline.py` (``plot_pipeline.py``) | 00:00.322 | 0.0 MB |
|
||||
| :ref:`sphx_glr_auto_examples_plot_pipeline.py` (``plot_pipeline.py``) | 00:00.290 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_backend.py` (``plot_backend.py``) | 00:00.021 | 0.0 MB |
|
||||
| :ref:`sphx_glr_auto_examples_plot_backend.py` (``plot_backend.py``) | 00:00.019 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_common_errors.py` (``plot_common_errors.py``) | 00:00.014 | 0.0 MB |
|
||||
| :ref:`sphx_glr_auto_examples_plot_common_errors.py` (``plot_common_errors.py``) | 00:00.011 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_load_and_predict.py` (``plot_load_and_predict.py``) | 00:00.013 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_metadata.py` (``plot_metadata.py``) | 00:00.010 | 0.0 MB |
|
||||
| :ref:`sphx_glr_auto_examples_plot_load_and_predict.py` (``plot_load_and_predict.py``) | 00:00.007 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_profiling.py` (``plot_profiling.py``) | 00:00.007 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
| :ref:`sphx_glr_auto_examples_plot_metadata.py` (``plot_metadata.py``) | 00:00.004 | 0.0 MB |
|
||||
+-------------------------------------------------------------------------------------------------------------+-----------+--------+
|
||||
|
|
|
|||
|
|
@ -1,134 +0,0 @@
|
|||
/*
|
||||
* _sphinx_javascript_frameworks_compat.js
|
||||
* ~~~~~~~~~~
|
||||
*
|
||||
* Compatability shim for jQuery and underscores.js.
|
||||
*
|
||||
* WILL BE REMOVED IN Sphinx 6.0
|
||||
* xref RemovedInSphinx60Warning
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* select a different prefix for underscore
|
||||
*/
|
||||
$u = _.noConflict();
|
||||
|
||||
|
||||
/**
|
||||
* small helper function to urldecode strings
|
||||
*
|
||||
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
|
||||
*/
|
||||
jQuery.urldecode = function(x) {
|
||||
if (!x) {
|
||||
return x
|
||||
}
|
||||
return decodeURIComponent(x.replace(/\+/g, ' '));
|
||||
};
|
||||
|
||||
/**
|
||||
* small helper function to urlencode strings
|
||||
*/
|
||||
jQuery.urlencode = encodeURIComponent;
|
||||
|
||||
/**
|
||||
* This function returns the parsed url parameters of the
|
||||
* current request. Multiple values per key are supported,
|
||||
* it will always return arrays of strings for the value parts.
|
||||
*/
|
||||
jQuery.getQueryParameters = function(s) {
|
||||
if (typeof s === 'undefined')
|
||||
s = document.location.search;
|
||||
var parts = s.substr(s.indexOf('?') + 1).split('&');
|
||||
var result = {};
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var tmp = parts[i].split('=', 2);
|
||||
var key = jQuery.urldecode(tmp[0]);
|
||||
var value = jQuery.urldecode(tmp[1]);
|
||||
if (key in result)
|
||||
result[key].push(value);
|
||||
else
|
||||
result[key] = [value];
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* highlight a given string on a jquery object by wrapping it in
|
||||
* span elements with the given class name.
|
||||
*/
|
||||
jQuery.fn.highlightText = function(text, className) {
|
||||
function highlight(node, addItems) {
|
||||
if (node.nodeType === 3) {
|
||||
var val = node.nodeValue;
|
||||
var pos = val.toLowerCase().indexOf(text);
|
||||
if (pos >= 0 &&
|
||||
!jQuery(node.parentNode).hasClass(className) &&
|
||||
!jQuery(node.parentNode).hasClass("nohighlight")) {
|
||||
var span;
|
||||
var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
|
||||
if (isInSVG) {
|
||||
span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
|
||||
} else {
|
||||
span = document.createElement("span");
|
||||
span.className = className;
|
||||
}
|
||||
span.appendChild(document.createTextNode(val.substr(pos, text.length)));
|
||||
node.parentNode.insertBefore(span, node.parentNode.insertBefore(
|
||||
document.createTextNode(val.substr(pos + text.length)),
|
||||
node.nextSibling));
|
||||
node.nodeValue = val.substr(0, pos);
|
||||
if (isInSVG) {
|
||||
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
|
||||
var bbox = node.parentElement.getBBox();
|
||||
rect.x.baseVal.value = bbox.x;
|
||||
rect.y.baseVal.value = bbox.y;
|
||||
rect.width.baseVal.value = bbox.width;
|
||||
rect.height.baseVal.value = bbox.height;
|
||||
rect.setAttribute('class', className);
|
||||
addItems.push({
|
||||
"parent": node.parentNode,
|
||||
"target": rect});
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!jQuery(node).is("button, select, textarea")) {
|
||||
jQuery.each(node.childNodes, function() {
|
||||
highlight(this, addItems);
|
||||
});
|
||||
}
|
||||
}
|
||||
var addItems = [];
|
||||
var result = this.each(function() {
|
||||
highlight(this, addItems);
|
||||
});
|
||||
for (var i = 0; i < addItems.length; ++i) {
|
||||
jQuery(addItems[i].parent).before(addItems[i].target);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
/*
|
||||
* backward compatibility for jQuery.browser
|
||||
* This will be supported until firefox bug is fixed.
|
||||
*/
|
||||
if (!jQuery.browser) {
|
||||
jQuery.uaMatch = function(ua) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(msie) ([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
return {
|
||||
browser: match[ 1 ] || "",
|
||||
version: match[ 2 ] || "0"
|
||||
};
|
||||
};
|
||||
jQuery.browser = {};
|
||||
jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
|
||||
}
|
||||
|
|
@ -419,7 +419,9 @@ table.footnote td {
|
|||
}
|
||||
|
||||
dl {
|
||||
margin: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
margin-top: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* Sphinx stylesheet -- basic theme.
|
||||
*
|
||||
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
|
@ -236,16 +236,6 @@ div.body p, div.body dd, div.body li, div.body blockquote {
|
|||
a.headerlink {
|
||||
visibility: hidden;
|
||||
}
|
||||
a.brackets:before,
|
||||
span.brackets > a:before{
|
||||
content: "[";
|
||||
}
|
||||
|
||||
a.brackets:after,
|
||||
span.brackets > a:after {
|
||||
content: "]";
|
||||
}
|
||||
|
||||
|
||||
h1:hover > a.headerlink,
|
||||
h2:hover > a.headerlink,
|
||||
|
|
@ -334,11 +324,17 @@ aside.sidebar {
|
|||
p.sidebar-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
div.admonition, div.topic, blockquote {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
/* -- topics ---------------------------------------------------------------- */
|
||||
|
||||
nav.contents,
|
||||
aside.topic,
|
||||
div.topic {
|
||||
border: 1px solid #ccc;
|
||||
padding: 7px;
|
||||
|
|
@ -377,6 +373,8 @@ div.body p.centered {
|
|||
|
||||
div.sidebar > :last-child,
|
||||
aside.sidebar > :last-child,
|
||||
nav.contents > :last-child,
|
||||
aside.topic > :last-child,
|
||||
div.topic > :last-child,
|
||||
div.admonition > :last-child {
|
||||
margin-bottom: 0;
|
||||
|
|
@ -384,6 +382,8 @@ div.admonition > :last-child {
|
|||
|
||||
div.sidebar::after,
|
||||
aside.sidebar::after,
|
||||
nav.contents::after,
|
||||
aside.topic::after,
|
||||
div.topic::after,
|
||||
div.admonition::after,
|
||||
blockquote::after {
|
||||
|
|
@ -608,19 +608,27 @@ ol.simple p,
|
|||
ul.simple p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
dl.footnote > dt,
|
||||
dl.citation > dt {
|
||||
float: left;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
|
||||
dl.footnote > dd,
|
||||
dl.citation > dd {
|
||||
aside.footnote > span,
|
||||
div.citation > span {
|
||||
float: left;
|
||||
}
|
||||
aside.footnote > span:last-of-type,
|
||||
div.citation > span:last-of-type {
|
||||
padding-right: 0.5em;
|
||||
}
|
||||
aside.footnote > p {
|
||||
margin-left: 2em;
|
||||
}
|
||||
div.citation > p {
|
||||
margin-left: 4em;
|
||||
}
|
||||
aside.footnote > p:last-of-type,
|
||||
div.citation > p:last-of-type {
|
||||
margin-bottom: 0em;
|
||||
}
|
||||
|
||||
dl.footnote > dd:after,
|
||||
dl.citation > dd:after {
|
||||
aside.footnote > p:last-of-type:after,
|
||||
div.citation > p:last-of-type:after {
|
||||
content: "";
|
||||
clear: both;
|
||||
}
|
||||
|
|
@ -636,10 +644,6 @@ dl.field-list > dt {
|
|||
padding-left: 0.5em;
|
||||
padding-right: 5px;
|
||||
}
|
||||
dl.field-list > dt:after {
|
||||
content: ":";
|
||||
}
|
||||
|
||||
|
||||
dl.field-list > dd {
|
||||
padding-left: 0.5em;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* Base JavaScript utilities for all Sphinx HTML documentation.
|
||||
*
|
||||
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* Sphinx stylesheet -- graphviz extension.
|
||||
*
|
||||
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
10881
docs/api/python/static/jquery-3.6.0.js
vendored
10881
docs/api/python/static/jquery-3.6.0.js
vendored
File diff suppressed because it is too large
Load diff
2
docs/api/python/static/jquery.js
vendored
2
docs/api/python/static/jquery.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -5,7 +5,7 @@
|
|||
* This script contains the language-specific data used by searchtools.js,
|
||||
* namely the list of stopwords, stemmer, scorer and splitter.
|
||||
*
|
||||
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* Sphinx JavaScript utilities for the full-text search.
|
||||
*
|
||||
* :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
|
||||
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
|
||||
* :license: BSD, see LICENSE for details.
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
|
@ -4,7 +4,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-156955408-1"></script>
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-dataframe.css" />
|
||||
<link rel="stylesheet" type="text/css" href="static/sg_gallery-rendered-html.css" />
|
||||
<script data-url_root="./" id="documentation_options" src="static/documentation_options.js"></script>
|
||||
<script src="static/jquery.js"></script>
|
||||
<script src="static/underscore.js"></script>
|
||||
<script src="static/_sphinx_javascript_frameworks_compat.js"></script>
|
||||
<script src="static/doctools.js"></script>
|
||||
<script src="static/sphinx_highlight.js"></script>
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
|
|
@ -85,15 +82,7 @@ ONNX format and run the first predictions.</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>>>></p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="o">/</span><span class="n">home</span><span class="o">/</span><span class="n">runner</span><span class="o">/.</span><span class="n">local</span><span class="o">/</span><span class="n">lib</span><span class="o">/</span><span class="n">python3</span><span class="mf">.10</span><span class="o">/</span><span class="n">site</span><span class="o">-</span><span class="n">packages</span><span class="o">/</span><span class="n">sklearn</span><span class="o">/</span><span class="n">linear_model</span><span class="o">/</span><span class="n">_logistic</span><span class="o">.</span><span class="n">py</span><span class="p">:</span><span class="mi">444</span><span class="p">:</span> <span class="n">ConvergenceWarning</span><span class="p">:</span> <span class="n">lbfgs</span> <span class="n">failed</span> <span class="n">to</span> <span class="n">converge</span> <span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="mi">1</span><span class="p">):</span>
|
||||
<span class="n">STOP</span><span class="p">:</span> <span class="n">TOTAL</span> <span class="n">NO</span><span class="o">.</span> <span class="n">of</span> <span class="n">ITERATIONS</span> <span class="n">REACHED</span> <span class="n">LIMIT</span><span class="o">.</span>
|
||||
|
||||
<span class="n">Increase</span> <span class="n">the</span> <span class="n">number</span> <span class="n">of</span> <span class="n">iterations</span> <span class="p">(</span><span class="n">max_iter</span><span class="p">)</span> <span class="ow">or</span> <span class="n">scale</span> <span class="n">the</span> <span class="n">data</span> <span class="k">as</span> <span class="n">shown</span> <span class="ow">in</span><span class="p">:</span>
|
||||
<span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">scikit</span><span class="o">-</span><span class="n">learn</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">stable</span><span class="o">/</span><span class="n">modules</span><span class="o">/</span><span class="n">preprocessing</span><span class="o">.</span><span class="n">html</span>
|
||||
<span class="n">Please</span> <span class="n">also</span> <span class="n">refer</span> <span class="n">to</span> <span class="n">the</span> <span class="n">documentation</span> <span class="k">for</span> <span class="n">alternative</span> <span class="n">solver</span> <span class="n">options</span><span class="p">:</span>
|
||||
<span class="n">https</span><span class="p">:</span><span class="o">//</span><span class="n">scikit</span><span class="o">-</span><span class="n">learn</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">stable</span><span class="o">/</span><span class="n">modules</span><span class="o">/</span><span class="n">linear_model</span><span class="o">.</span><span class="n">html</span><span class="c1">#logistic-regression</span>
|
||||
<span class="n">n_iter_i</span> <span class="o">=</span> <span class="n">_check_optimize_result</span><span class="p">(</span>
|
||||
<span class="n">LogisticRegression</span><span class="p">()</span>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">LogisticRegression</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
@ -136,7 +125,7 @@ for this machine learning model.</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>>>></p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="p">[</span><span class="mi">0</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">0</span>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="p">[</span><span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span>
|
||||
<span class="mi">2</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
|
|
@ -156,7 +145,7 @@ by specifying its name into a list.</p>
|
|||
</pre></div>
|
||||
</div>
|
||||
<p>>>></p>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="p">[</span><span class="mi">0</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">0</span>
|
||||
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="p">[</span><span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">0</span> <span class="mi">1</span> <span class="mi">2</span> <span class="mi">0</span> <span class="mi">0</span> <span class="mi">2</span> <span class="mi">1</span> <span class="mi">1</span>
|
||||
<span class="mi">2</span><span class="p">]</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
|
|
@ -224,8 +213,8 @@ by specifying its name into a list.</p>
|
|||
©2018-2021, Microsoft.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 5.3.0</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 6.1.3</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.13</a>
|
||||
|
||||
|
|
||||
<a href="sources/tutorial.rst.txt"
|
||||
|
|
|
|||
Loading…
Reference in a new issue