blob: 67494662735428489b6c8e20bc592fbec7b0e85f [file] [log] [blame]
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Onnx Helper &mdash; SystemDS 2.0.0 documentation</title>
<link rel="stylesheet" href="../../static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../../static/pygments.css" type="text/css" />
<!--[if lt IE 9]>
<script src="../../static/js/html5shiv.min.js"></script>
<![endif]-->
<script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../static/documentation_options.js"></script>
<script src="../../static/jquery.js"></script>
<script src="../../static/underscore.js"></script>
<script src="../../static/doctools.js"></script>
<script src="../../static/language_data.js"></script>
<script type="text/javascript" src="../../static/js/theme.js"></script>
<link rel="index" title="Index" href="../../genindex.html" />
<link rel="search" title="Search" href="../../search.html" />
<link rel="next" title="Operator Gen" href="operator_gen.html" />
<link rel="prev" title="Convert" href="convert.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../../index.html" class="icon icon-home" alt="Documentation Home"> SystemDS
</a>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
<p class="caption"><span class="caption-text">Getting Started:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../getting_started/install.html">Install SystemDS</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../getting_started/simple_examples.html">QuickStart</a></li>
</ul>
<p class="caption"><span class="caption-text">Guides</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../guide/federated.html">Federated Environment</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../guide/algorithms_basics.html">Built-in Algorithms</a></li>
</ul>
<p class="caption"><span class="caption-text">Onnx SystemDS</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../onnx_systemds/onnx_systemds.html">QuickStart Onnx</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../onnx_systemds/onnx_systemds_design.html">Design</a></li>
</ul>
<p class="caption"><span class="caption-text">API</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../operator/algorithms.html">Algorithms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../context/systemds_context.html">SystemDSContext</a></li>
<li class="toctree-l1"><a class="reference internal" href="../matrix/matrix.html">Matrix</a></li>
<li class="toctree-l1"><a class="reference internal" href="../matrix/federated.html">Federated</a></li>
<li class="toctree-l1"><a class="reference internal" href="../operator/operation_node.html">Operation Node</a></li>
<li class="toctree-l1"><a class="reference internal" href="convert.html">Convert</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Onnx Helper</a></li>
<li class="toctree-l1"><a class="reference internal" href="operator_gen.html">Operator Gen</a></li>
<li class="toctree-l1"><a class="reference internal" href="render.html">Render</a></li>
<li class="toctree-l1"><a class="reference internal" href="util.html">Util</a></li>
</ul>
<p class="caption"><span class="caption-text">Internals API</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../script_building/dag.html">Dag</a></li>
<li class="toctree-l1"><a class="reference internal" href="../script_building/script.html">Script</a></li>
<li class="toctree-l1"><a class="reference internal" href="../utils/converters.html">Converters</a></li>
<li class="toctree-l1"><a class="reference internal" href="../utils/helpers.html">Helpers</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
<nav class="wy-nav-top" aria-label="top navigation">
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../../index.html">SystemDS</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="breadcrumbs navigation">
<ul class="wy-breadcrumbs">
<li><a href="../../index.html" class="icon icon-home"></a> &raquo;</li>
<li>Onnx Helper</li>
<li class="wy-breadcrumbs-aside">
<a href="../../sources/api/onnx_systemds/onnx_helper.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<div class="section" id="module-systemds.onnx_systemds.onnx_helper">
<span id="onnx-helper"></span><h1>Onnx Helper<a class="headerlink" href="#module-systemds.onnx_systemds.onnx_helper" title="Permalink to this headline"></a></h1>
<dl class="py class">
<dt id="systemds.onnx_systemds.onnx_helper.NodeTree">
<em class="property">class </em><code class="sig-prename descclassname">systemds.onnx_systemds.onnx_helper.</code><code class="sig-name descname">NodeTree</code><span class="sig-paren">(</span><em class="sig-param">nodes: [&lt;class 'onnx.onnx_ONNX_REL_1_7_ml_pb2.NodeProto'&gt;]</em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.onnx_systemds.onnx_helper.NodeTree" title="Permalink to this definition"></a></dt>
<dd><p>A simple class for representing a tree structure of nodes</p>
<dl class="py method">
<dt id="systemds.onnx_systemds.onnx_helper.NodeTree.remove_end_node">
<code class="sig-name descname">remove_end_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node</span><span class="p">:</span> <span class="n">systemds.onnx_systemds.onnx_helper.TreeNode</span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.onnx_systemds.onnx_helper.NodeTree.remove_end_node" title="Permalink to this definition"></a></dt>
<dd><p>Removes the given end-node from the tree.
Removing a non-existing or non end-node raises an exception.
:param node: The node that shall be removed</p>
</dd></dl>
</dd></dl>
<dl class="py class">
<dt id="systemds.onnx_systemds.onnx_helper.PreparedValue">
<em class="property">class </em><code class="sig-prename descclassname">systemds.onnx_systemds.onnx_helper.</code><code class="sig-name descname">PreparedValue</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">value_info</span><span class="p">:</span> <span class="n">onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto</span></em>, <em class="sig-param"><span class="n">initializer</span><span class="p">:</span> <span class="n">onnx.onnx_ONNX_REL_1_7_ml_pb2.TensorProto</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#systemds.onnx_systemds.onnx_helper.PreparedValue" title="Permalink to this definition"></a></dt>
<dd><p>Class for preparing onnx value structures for writing them to the dml script</p>
</dd></dl>
<dl class="py function">
<dt id="systemds.onnx_systemds.onnx_helper.get_graph_inputs_with_initializers">
<code class="sig-prename descclassname">systemds.onnx_systemds.onnx_helper.</code><code class="sig-name descname">get_graph_inputs_with_initializers</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">graph</span><span class="p">:</span> <span class="n">onnx.onnx_ONNX_REL_1_7_ml_pb2.GraphProto</span></em><span class="sig-paren">)</span> &#x2192; [(&lt;class ‘onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto’&gt;, &lt;class ‘onnx.onnx_ONNX_REL_1_7_ml_pb2.TensorProto’&gt;)]<a class="headerlink" href="#systemds.onnx_systemds.onnx_helper.get_graph_inputs_with_initializers" title="Permalink to this definition"></a></dt>
<dd><p>Returns all initialized inputs of the <cite>graph</cite> with their corresponding initializer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>graph</strong> – the onnx-graph</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list of tuples of (input, initializer)</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="systemds.onnx_systemds.onnx_helper.get_graph_inputs_without_initializers">
<code class="sig-prename descclassname">systemds.onnx_systemds.onnx_helper.</code><code class="sig-name descname">get_graph_inputs_without_initializers</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">graph</span><span class="p">:</span> <span class="n">onnx.onnx_ONNX_REL_1_7_ml_pb2.GraphProto</span></em><span class="sig-paren">)</span> &#x2192; [&lt;class ‘onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto’&gt;]<a class="headerlink" href="#systemds.onnx_systemds.onnx_helper.get_graph_inputs_without_initializers" title="Permalink to this definition"></a></dt>
<dd><p>Returns all inputs of the <cite>graph</cite> that have no associated initializer values.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>graph</strong> – the onnx-graph</p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>list of uninitialized inputs</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="systemds.onnx_systemds.onnx_helper.get_value_info">
<code class="sig-prename descclassname">systemds.onnx_systemds.onnx_helper.</code><code class="sig-name descname">get_value_info</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">graph</span><span class="p">:</span> <span class="n">onnx.onnx_ONNX_REL_1_7_ml_pb2.GraphProto</span></em>, <em class="sig-param"><span class="n">name</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> &#x2192; onnx.onnx_ONNX_REL_1_7_ml_pb2.ValueInfoProto<a class="headerlink" href="#systemds.onnx_systemds.onnx_helper.get_value_info" title="Permalink to this definition"></a></dt>
<dd><p>Searches the <cite>graph</cite> for the given <cite>name</cite> and returns the associated ValueInfo,
if the name is not found None is returned.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>graph</strong> – the onnx-graph that shall be searched</p></li>
<li><p><strong>name</strong> – the name of the value</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>the value-info or None if it is not found</p>
</dd>
</dl>
</dd></dl>
<dl class="py function">
<dt id="systemds.onnx_systemds.onnx_helper.load_model">
<code class="sig-prename descclassname">systemds.onnx_systemds.onnx_helper.</code><code class="sig-name descname">load_model</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">onnx_file</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> &#x2192; onnx.onnx_ONNX_REL_1_7_ml_pb2.ModelProto<a class="headerlink" href="#systemds.onnx_systemds.onnx_helper.load_model" title="Permalink to this definition"></a></dt>
<dd><p>Loads the onnx file, checks the model and converts it to a common version if necessary.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>onnx_file</strong></p>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>the loaded onnx-model</p>
</dd>
</dl>
</dd></dl>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="operator_gen.html" class="btn btn-neutral float-right" title="Operator Gen" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="convert.html" class="btn btn-neutral float-left" title="Convert" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2020, Apache SystemDS
</p>
</div>
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
<a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
provided by <a href="https://readthedocs.org">Read the Docs</a>.
</footer>
</div>
</div>
</section>
</div>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>