Added: incubator/singa/site/trunk/en/docs/loss.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/loss.html?rev=1858059&view=auto ============================================================================== --- incubator/singa/site/trunk/en/docs/loss.html (added) +++ incubator/singa/site/trunk/en/docs/loss.html Wed Apr 24 14:57:35 2019 @@ -0,0 +1,484 @@ + + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Loss — incubator-singa 1.1.0 documentation</title> + + + + + + + + + <script type="text/javascript" src="../_static/js/modernizr.min.js"></script> + + + <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + <script type="text/javascript" src="../_static/language_data.js"></script> + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> + <link rel="index" title="Index" href="../genindex.html" /> + <link rel="search" title="Search" href="../search.html" /> + <link rel="next" title="Metric" href="metric.html" /> + <link rel="prev" title="Initializer" href="initializer.html" /> + <link href="../_static/style.css" rel="stylesheet" type="text/css"> + <!--link href="../_static/fontawesome-all.min.css" rel="stylesheet" type="text/css"--> + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous"> + <style> + .fa:hover { + opacity: 0.7; + } + .fab:hover { + opacity: 0.7; + } + </style> + +</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"> incubator-singa + + + + + <img src="../_static/singa.png" class="logo" alt="Logo"/> + + </a> + + + + + <div class="version"> + latest + </div> + + + + +<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"> + + + + + + + <ul class="current"> +<li class="toctree-l1 current"><a class="reference internal" href="index.html">Documentation</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="installation.html">Installation</a></li> +<li class="toctree-l2"><a class="reference internal" href="software_stack.html">Software Stack</a></li> +<li class="toctree-l2"><a class="reference internal" href="device.html">Device</a></li> +<li class="toctree-l2"><a class="reference internal" href="tensor.html">Tensor</a></li> +<li class="toctree-l2"><a class="reference internal" href="layer.html">Layer</a></li> +<li class="toctree-l2"><a class="reference internal" href="net.html">FeedForward Net</a></li> +<li class="toctree-l2"><a class="reference internal" href="initializer.html">Initializer</a></li> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Loss</a></li> +<li class="toctree-l2"><a class="reference internal" href="metric.html">Metric</a></li> +<li class="toctree-l2"><a class="reference internal" href="optimizer.html">Optimizer</a></li> +<li class="toctree-l2"><a class="reference internal" href="autograd.html">Autograd in Singa</a></li> +<li class="toctree-l2"><a class="reference internal" href="data.html">Data</a></li> +<li class="toctree-l2"><a class="reference internal" href="image_tool.html">Image Tool</a></li> +<li class="toctree-l2"><a class="reference internal" href="snapshot.html">Snapshot</a></li> +<li class="toctree-l2"><a class="reference internal" href="converter.html">Caffe Converter</a></li> +<li class="toctree-l2"><a class="reference internal" href="utils.html">Utils</a></li> +<li class="toctree-l2"><a class="reference internal" href="model_zoo/index.html">Model Zoo</a></li> +<li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../downloads.html">Download SINGA</a></li> +</ul> +<p class="caption"><span class="caption-text">Development</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../develop/schedule.html">Development Schedule</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/how-contribute.html">How to Contribute to SINGA</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/how-contribute.html#how-to-become-a-singa-committer">How to become a SINGA committer</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/contribute-code.html">How to Contribute Code</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/contribute-docs.html">How to Contribute to Documentation</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/how-to-release.html">How to prepare a release</a></li> +</ul> +<p class="caption"><span class="caption-text">Community</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../community/source-repository.html">Source Repository</a></li> +<li class="toctree-l1"><a class="reference internal" href="../community/mail-lists.html">Project Mailing Lists</a></li> +<li class="toctree-l1"><a class="reference internal" href="../community/issue-tracking.html">Issue Tracking</a></li> +<li class="toctree-l1"><a class="reference internal" href="../community/team-list.html">The SINGA Team</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">incubator-singa</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">Docs</a> »</li> + + <li><a href="index.html">Documentation</a> »</li> + + <li>Loss</li> + + + <li class="wy-breadcrumbs-aside"> + + + + </li> + + </ul> + + + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="module-singa.loss"> +<span id="loss"></span><h1>Loss<a class="headerlink" href="#module-singa.loss" title="Permalink to this headline">¶</a></h1> +<p>Loss module includes a set of training loss implmentations. Some are converted +from C++ implementation, and the rest are implemented directly using python +Tensor.</p> +<p>Example usage:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">tensor</span> +<span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">loss</span> + +<span class="n">x</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">Tensor</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span> +<span class="n">x</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># randomly genearte the prediction activation</span> +<span class="n">y</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">from_numpy</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">int</span><span class="p">))</span> <span class="c1"># set the truth</span> + +<span class="n">f</span> <span class="o">=</span> <span class="n">loss</span><span class="o">.</span><span class="n">SoftmaxCrossEntropy</span><span class="p">()</span> +<span class="n">l</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="kc">True</span><span class="p">,</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># l is tensor with 3 loss values</span> +<span class="n">g</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">backward</span><span class="p">()</span> <span class="c1"># g is a tensor containing all gradients of x w.r.t l</span> +</pre></div> +</div> +<dl class="class"> +<dt id="singa.loss.Loss"> +<em class="property">class </em><code class="descclassname">singa.loss.</code><code class="descname">Loss</code><a class="headerlink" href="#singa.loss.Loss" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p> +<p>Base loss class.</p> +<p>Subclasses that wrap the C++ loss classes can use the inherited foward, +backward, and evaluate functions of this base class. Other subclasses need +to override these functions</p> +<dl class="method"> +<dt id="singa.loss.Loss.backward"> +<code class="descname">backward</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.Loss.backward" title="Permalink to this definition">¶</a></dt> +<dd><dl class="field-list simple"> +<dt class="field-odd">Returns</dt> +<dd class="field-odd"><p>the grad of x w.r.t. the loss</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.loss.Loss.evaluate"> +<code class="descname">evaluate</code><span class="sig-paren">(</span><em>flag</em>, <em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.Loss.evaluate" title="Permalink to this definition">¶</a></dt> +<dd><dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>flag</strong> (<em>int</em>) â must be kEval, to be removed</p></li> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the prediction Tensor</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the ground truth Tnesor</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>the averaged loss for all samples in x.</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.loss.Loss.forward"> +<code class="descname">forward</code><span class="sig-paren">(</span><em>flag</em>, <em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.Loss.forward" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the loss values.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>flag</strong> â kTrain/kEval or bool. If it is kTrain/True, then the backward +function must be called before calling forward again.</p></li> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the prediction Tensor</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the ground truch Tensor, x.shape[0] must = y.shape[0]</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a tensor of floats for the loss values, one per sample</p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="class"> +<dt id="singa.loss.SigmoidCrossEntropy"> +<em class="property">class </em><code class="descclassname">singa.loss.</code><code class="descname">SigmoidCrossEntropy</code><span class="sig-paren">(</span><em>epsilon=1e-08</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.SigmoidCrossEntropy" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <a class="reference internal" href="#singa.loss.Loss" title="singa.loss.Loss"><code class="xref py py-class docutils literal notranslate"><span class="pre">singa.loss.Loss</span></code></a></p> +<p>This loss evaluates the cross-entropy loss between the prediction and the +truth values with the prediction probability generated from Sigmoid.</p> +<dl class="method"> +<dt id="singa.loss.SigmoidCrossEntropy.backward"> +<code class="descname">backward</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.SigmoidCrossEntropy.backward" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the gradient of loss w.r.t to x.</p> +<dl class="field-list simple"> +<dt class="field-odd">Returns</dt> +<dd class="field-odd"><p>dx = pi - yi.</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.loss.SigmoidCrossEntropy.evaluate"> +<code class="descname">evaluate</code><span class="sig-paren">(</span><em>flag</em>, <em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.SigmoidCrossEntropy.evaluate" title="Permalink to this definition">¶</a></dt> +<dd><p>Compuate the averaged error.</p> +<dl class="field-list simple"> +<dt class="field-odd">Returns</dt> +<dd class="field-odd"><p>a float value as the averaged error</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.loss.SigmoidCrossEntropy.forward"> +<code class="descname">forward</code><span class="sig-paren">(</span><em>flag</em>, <em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.SigmoidCrossEntropy.forward" title="Permalink to this definition">¶</a></dt> +<dd><p>loss is -yi * log pi - (1-yi) log (1-pi), where pi=sigmoid(xi)</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>flag</strong> (<em>bool</em>) â true for training; false for evaluation</p></li> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the prediction Tensor</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the truth Tensor, a binary array value per sample</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a Tensor with one error value per sample</p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="class"> +<dt id="singa.loss.SoftmaxCrossEntropy"> +<em class="property">class </em><code class="descclassname">singa.loss.</code><code class="descname">SoftmaxCrossEntropy</code><a class="headerlink" href="#singa.loss.SoftmaxCrossEntropy" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <a class="reference internal" href="#singa.loss.Loss" title="singa.loss.Loss"><code class="xref py py-class docutils literal notranslate"><span class="pre">singa.loss.Loss</span></code></a></p> +<p>This loss function is a combination of SoftMax and Cross-Entropy loss.</p> +<p>It converts the inputs via SoftMax function and then +computes the cross-entropy loss against the ground truth values.</p> +<p>For each sample, the ground truth could be a integer as the label index; +or a binary array, indicating the label distribution. The ground truth +tensor thus could be a 1d or 2d tensor. +The data/feature tensor could 1d (for a single sample) or 2d for a batch of +samples.</p> +</dd></dl> + +<dl class="class"> +<dt id="singa.loss.SquaredError"> +<em class="property">class </em><code class="descclassname">singa.loss.</code><code class="descname">SquaredError</code><a class="headerlink" href="#singa.loss.SquaredError" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <a class="reference internal" href="#singa.loss.Loss" title="singa.loss.Loss"><code class="xref py py-class docutils literal notranslate"><span class="pre">singa.loss.Loss</span></code></a></p> +<p>This loss evaluates the squared error between the prediction and the +truth values.</p> +<p>It is implemented using Python Tensor operations.</p> +<dl class="method"> +<dt id="singa.loss.SquaredError.backward"> +<code class="descname">backward</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.SquaredError.backward" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the gradient of x w.r.t the error.</p> +<dl class="field-list simple"> +<dt class="field-odd">Returns</dt> +<dd class="field-odd"><p>x - y</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.loss.SquaredError.evaluate"> +<code class="descname">evaluate</code><span class="sig-paren">(</span><em>flag</em>, <em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.SquaredError.evaluate" title="Permalink to this definition">¶</a></dt> +<dd><p>Compuate the averaged error.</p> +<dl class="field-list simple"> +<dt class="field-odd">Returns</dt> +<dd class="field-odd"><p>a float value as the averaged error</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.loss.SquaredError.forward"> +<code class="descname">forward</code><span class="sig-paren">(</span><em>flag</em>, <em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.loss.SquaredError.forward" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the error as 0.5 * ||x-y||^2.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>flag</strong> (<em>int</em>) â kTrain or kEval; if kTrain, then the backward must be +called before calling forward again.</p></li> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the prediction Tensor</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â the truth Tensor, an integer value per sample, whose +value is [0, x.shape[1])</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a Tensor with one error value per sample</p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +</div> + + + </div> + + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="metric.html" class="btn btn-neutral float-right" title="Metric" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="initializer.html" class="btn btn-neutral float-left" title="Initializer" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2019 The Apache Software Foundation. All rights reserved. Apache SINGA, Apache, the Apache feather logo, and the Apache SINGA project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. + + </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> + + + + + + +<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> + <span class="rst-current-version" data-toggle="rst-current-version"> + <span class="fa fa-book"> incubator-singa </span> + v: latest + <span class="fa fa-caret-down"></span> + </span> + <div class="rst-other-versions"> + <dl> + <dt>Languages</dt> + <dd><a href="../../en/index.html">English</a></dd> + <dd><a href="../../zh/index.html">䏿</a></dd> + </dl> + <dl> + <dt>Versions</dt> + <dd><a href="http://singa.apache.org/v0.3.0/">0.3</a></dd> + <dd><a href="http://singa.apache.org/v1.1.0/">1.1</a></dd> + </dl> + + </div> + <a href="http://incubator.apache.org/"> <img src= "../_static/apache.png" style="background-color:white;"> </a> + + <a href="https://github.com/apache/incubator-singa" class="fa fa-github" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://aws.amazon.com/marketplace/seller-profile?id=5bcac385-12c4-4802-aec7-351e09b77b4c" class="fab fa-aws" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://hub.docker.com/r/apache/singa/" class="fab fa-docker" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.linkedin.com/groups/13550034" class="fa fa-linkedin" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://twitter.com/ApacheSinga" class="fa fa-twitter" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.facebook.com/Apache-SINGA-347284219056544/" class="fa fa-facebook" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.researchgate.net/project/Apache-SINGA" class="fab fa-researchgate" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + +</div> + + <a href="https://github.com/apache/incubator-singa"> + <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;" + src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" + alt="Fork me on GitHub"> +</a> + + + + +</body> +</html> \ No newline at end of file
Added: incubator/singa/site/trunk/en/docs/metric.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/metric.html?rev=1858059&view=auto ============================================================================== --- incubator/singa/site/trunk/en/docs/metric.html (added) +++ incubator/singa/site/trunk/en/docs/metric.html Wed Apr 24 14:57:35 2019 @@ -0,0 +1,454 @@ + + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Metric — incubator-singa 1.1.0 documentation</title> + + + + + + + + + <script type="text/javascript" src="../_static/js/modernizr.min.js"></script> + + + <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script> + <script type="text/javascript" src="../_static/jquery.js"></script> + <script type="text/javascript" src="../_static/underscore.js"></script> + <script type="text/javascript" src="../_static/doctools.js"></script> + <script type="text/javascript" src="../_static/language_data.js"></script> + + <script type="text/javascript" src="../_static/js/theme.js"></script> + + + + + <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> + <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> + <link rel="index" title="Index" href="../genindex.html" /> + <link rel="search" title="Search" href="../search.html" /> + <link rel="next" title="Optimizer" href="optimizer.html" /> + <link rel="prev" title="Loss" href="loss.html" /> + <link href="../_static/style.css" rel="stylesheet" type="text/css"> + <!--link href="../_static/fontawesome-all.min.css" rel="stylesheet" type="text/css"--> + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous"> + <style> + .fa:hover { + opacity: 0.7; + } + .fab:hover { + opacity: 0.7; + } + </style> + +</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"> incubator-singa + + + + + <img src="../_static/singa.png" class="logo" alt="Logo"/> + + </a> + + + + + <div class="version"> + latest + </div> + + + + +<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"> + + + + + + + <ul class="current"> +<li class="toctree-l1 current"><a class="reference internal" href="index.html">Documentation</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="installation.html">Installation</a></li> +<li class="toctree-l2"><a class="reference internal" href="software_stack.html">Software Stack</a></li> +<li class="toctree-l2"><a class="reference internal" href="device.html">Device</a></li> +<li class="toctree-l2"><a class="reference internal" href="tensor.html">Tensor</a></li> +<li class="toctree-l2"><a class="reference internal" href="layer.html">Layer</a></li> +<li class="toctree-l2"><a class="reference internal" href="net.html">FeedForward Net</a></li> +<li class="toctree-l2"><a class="reference internal" href="initializer.html">Initializer</a></li> +<li class="toctree-l2"><a class="reference internal" href="loss.html">Loss</a></li> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Metric</a></li> +<li class="toctree-l2"><a class="reference internal" href="optimizer.html">Optimizer</a></li> +<li class="toctree-l2"><a class="reference internal" href="autograd.html">Autograd in Singa</a></li> +<li class="toctree-l2"><a class="reference internal" href="data.html">Data</a></li> +<li class="toctree-l2"><a class="reference internal" href="image_tool.html">Image Tool</a></li> +<li class="toctree-l2"><a class="reference internal" href="snapshot.html">Snapshot</a></li> +<li class="toctree-l2"><a class="reference internal" href="converter.html">Caffe Converter</a></li> +<li class="toctree-l2"><a class="reference internal" href="utils.html">Utils</a></li> +<li class="toctree-l2"><a class="reference internal" href="model_zoo/index.html">Model Zoo</a></li> +<li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../downloads.html">Download SINGA</a></li> +</ul> +<p class="caption"><span class="caption-text">Development</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../develop/schedule.html">Development Schedule</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/how-contribute.html">How to Contribute to SINGA</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/how-contribute.html#how-to-become-a-singa-committer">How to become a SINGA committer</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/contribute-code.html">How to Contribute Code</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/contribute-docs.html">How to Contribute to Documentation</a></li> +<li class="toctree-l1"><a class="reference internal" href="../develop/how-to-release.html">How to prepare a release</a></li> +</ul> +<p class="caption"><span class="caption-text">Community</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../community/source-repository.html">Source Repository</a></li> +<li class="toctree-l1"><a class="reference internal" href="../community/mail-lists.html">Project Mailing Lists</a></li> +<li class="toctree-l1"><a class="reference internal" href="../community/issue-tracking.html">Issue Tracking</a></li> +<li class="toctree-l1"><a class="reference internal" href="../community/team-list.html">The SINGA Team</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">incubator-singa</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">Docs</a> »</li> + + <li><a href="index.html">Documentation</a> »</li> + + <li>Metric</li> + + + <li class="wy-breadcrumbs-aside"> + + + + </li> + + </ul> + + + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <div class="section" id="module-singa.metric"> +<span id="metric"></span><h1>Metric<a class="headerlink" href="#module-singa.metric" title="Permalink to this headline">¶</a></h1> +<p>This module includes a set of metric classes for evaluating the modelâs +performance. The specific metric classes could be converted from C++ +implmentation or implemented directly using Python.</p> +<p>Example usage:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">tensor</span> +<span class="kn">from</span> <span class="nn">singa</span> <span class="k">import</span> <span class="n">metric</span> + +<span class="n">x</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">Tensor</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span> <span class="mi">5</span><span class="p">))</span> +<span class="n">x</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># randomly genearte the prediction activation</span> +<span class="n">x</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">SoftMax</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="c1"># normalize the prediction into probabilities</span> +<span class="n">y</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">from_numpy</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="n">np</span><span class="o">.</span><span class="n">int</span><span class="p">))</span> <span class="c1"># set the truth</span> + +<span class="n">f</span> <span class="o">=</span> <span class="n">metric</span><span class="o">.</span><span class="n">Accuracy</span><span class="p">()</span> +<span class="n">acc</span> <span class="o">=</span> <span class="n">f</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span> <span class="c1"># averaged accuracy over all 3 samples in x</span> +</pre></div> +</div> +<dl class="class"> +<dt id="singa.metric.Metric"> +<em class="property">class </em><code class="descclassname">singa.metric.</code><code class="descname">Metric</code><a class="headerlink" href="#singa.metric.Metric" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p> +<p>Base metric class.</p> +<p>Subclasses that wrap the C++ loss classes can use the inherited foward, +and evaluate functions of this base class. Other subclasses need +to override these functions. Users need to feed in the <strong>predictions</strong> and +ground truth to get the metric values.</p> +<dl class="method"> +<dt id="singa.metric.Metric.forward"> +<code class="descname">forward</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Metric.forward" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the metric for each sample.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â predictions, one row per sample</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â ground truth values, one row per sample</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a tensor of floats, one per sample</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.metric.Metric.evaluate"> +<code class="descname">evaluate</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Metric.evaluate" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the averaged metric over all samples.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â predictions, one row per sample</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â ground truth values, one row per sample</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a float value for the averaged metric</p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="class"> +<dt id="singa.metric.Accuracy"> +<em class="property">class </em><code class="descclassname">singa.metric.</code><code class="descname">Accuracy</code><a class="headerlink" href="#singa.metric.Accuracy" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <a class="reference internal" href="#singa.metric.Metric" title="singa.metric.Metric"><code class="xref py py-class docutils literal notranslate"><span class="pre">singa.metric.Metric</span></code></a></p> +<p>Compute the top one accuracy for single label prediction tasks.</p> +<p>It calls the C++ functions to do the calculation.</p> +</dd></dl> + +<dl class="class"> +<dt id="singa.metric.Precision"> +<em class="property">class </em><code class="descclassname">singa.metric.</code><code class="descname">Precision</code><span class="sig-paren">(</span><em>top_k</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Precision" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <a class="reference internal" href="#singa.metric.Metric" title="singa.metric.Metric"><code class="xref py py-class docutils literal notranslate"><span class="pre">singa.metric.Metric</span></code></a></p> +<p>Make the top-k labels of max probability as the prediction</p> +<p>Compute the precision against the groundtruth labels</p> +<dl class="method"> +<dt id="singa.metric.Precision.forward"> +<code class="descname">forward</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Precision.forward" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the precision for each sample.</p> +<p>Convert tensor to numpy for computation</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â predictions, one row per sample</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â ground truth labels, one row per sample</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a tensor of floats, one per sample</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.metric.Precision.evaluate"> +<code class="descname">evaluate</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Precision.evaluate" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the averaged precision over all samples.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â predictions, one row per sample</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â ground truth values, one row per sample</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a float value for the averaged metric</p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +<dl class="class"> +<dt id="singa.metric.Recall"> +<em class="property">class </em><code class="descclassname">singa.metric.</code><code class="descname">Recall</code><span class="sig-paren">(</span><em>top_k</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Recall" title="Permalink to this definition">¶</a></dt> +<dd><p>Bases: <a class="reference internal" href="#singa.metric.Metric" title="singa.metric.Metric"><code class="xref py py-class docutils literal notranslate"><span class="pre">singa.metric.Metric</span></code></a></p> +<p>Make the top-k labels of max probability as the prediction</p> +<p>Compute the recall against the groundtruth labels</p> +<dl class="method"> +<dt id="singa.metric.Recall.forward"> +<code class="descname">forward</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Recall.forward" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the recall for each sample.</p> +<p>Convert tensor to numpy for computation</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â predictions, one row per sample</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â ground truth labels, one row per sample</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a tensor of floats, one per sample</p> +</dd> +</dl> +</dd></dl> + +<dl class="method"> +<dt id="singa.metric.Recall.evaluate"> +<code class="descname">evaluate</code><span class="sig-paren">(</span><em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.metric.Recall.evaluate" title="Permalink to this definition">¶</a></dt> +<dd><p>Compute the averaged precision over all samples.</p> +<dl class="field-list simple"> +<dt class="field-odd">Parameters</dt> +<dd class="field-odd"><ul class="simple"> +<li><p><strong>x</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â predictions, one row per sample</p></li> +<li><p><strong>y</strong> (<a class="reference internal" href="tensor.html#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) â ground truth values, one row per sample</p></li> +</ul> +</dd> +<dt class="field-even">Returns</dt> +<dd class="field-even"><p>a float value for the averaged metric</p> +</dd> +</dl> +</dd></dl> + +</dd></dl> + +</div> + + + </div> + + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="optimizer.html" class="btn btn-neutral float-right" title="Optimizer" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="loss.html" class="btn btn-neutral float-left" title="Loss" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2019 The Apache Software Foundation. All rights reserved. Apache SINGA, Apache, the Apache feather logo, and the Apache SINGA project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. + + </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> + + + + + + +<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> + <span class="rst-current-version" data-toggle="rst-current-version"> + <span class="fa fa-book"> incubator-singa </span> + v: latest + <span class="fa fa-caret-down"></span> + </span> + <div class="rst-other-versions"> + <dl> + <dt>Languages</dt> + <dd><a href="../../en/index.html">English</a></dd> + <dd><a href="../../zh/index.html">䏿</a></dd> + </dl> + <dl> + <dt>Versions</dt> + <dd><a href="http://singa.apache.org/v0.3.0/">0.3</a></dd> + <dd><a href="http://singa.apache.org/v1.1.0/">1.1</a></dd> + </dl> + + </div> + <a href="http://incubator.apache.org/"> <img src= "../_static/apache.png" style="background-color:white;"> </a> + + <a href="https://github.com/apache/incubator-singa" class="fa fa-github" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://aws.amazon.com/marketplace/seller-profile?id=5bcac385-12c4-4802-aec7-351e09b77b4c" class="fab fa-aws" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://hub.docker.com/r/apache/singa/" class="fab fa-docker" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.linkedin.com/groups/13550034" class="fa fa-linkedin" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://twitter.com/ApacheSinga" class="fa fa-twitter" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.facebook.com/Apache-SINGA-347284219056544/" class="fa fa-facebook" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.researchgate.net/project/Apache-SINGA" class="fab fa-researchgate" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + +</div> + + <a href="https://github.com/apache/incubator-singa"> + <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;" + src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" + alt="Fork me on GitHub"> +</a> + + + + +</body> +</html> \ No newline at end of file Added: incubator/singa/site/trunk/en/docs/model_zoo/caffe/README.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/model_zoo/caffe/README.html?rev=1858059&view=auto ============================================================================== --- incubator/singa/site/trunk/en/docs/model_zoo/caffe/README.html (added) +++ incubator/singa/site/trunk/en/docs/model_zoo/caffe/README.html Wed Apr 24 14:57:35 2019 @@ -0,0 +1,318 @@ + + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Use parameters pre-trained from Caffe in SINGA — incubator-singa 1.1.0 documentation</title> + + + + + + + + + <script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script> + + + <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script> + <script type="text/javascript" src="../../../_static/jquery.js"></script> + <script type="text/javascript" src="../../../_static/underscore.js"></script> + <script type="text/javascript" src="../../../_static/doctools.js"></script> + <script type="text/javascript" src="../../../_static/language_data.js"></script> + + <script type="text/javascript" src="../../../_static/js/theme.js"></script> + + + + + <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" /> + <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> + <link rel="index" title="Index" href="../../../genindex.html" /> + <link rel="search" title="Search" href="../../../search.html" /> + <link href="../../../_static/style.css" rel="stylesheet" type="text/css"> + <!--link href="../../../_static/fontawesome-all.min.css" rel="stylesheet" type="text/css"--> + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous"> + <style> + .fa:hover { + opacity: 0.7; + } + .fab:hover { + opacity: 0.7; + } + </style> + +</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"> incubator-singa + + + + + <img src="../../../_static/singa.png" class="logo" alt="Logo"/> + + </a> + + + + + <div class="version"> + latest + </div> + + + + +<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"> + + + + + + + <ul> +<li class="toctree-l1"><a class="reference internal" href="../../index.html">Documentation</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../downloads.html">Download SINGA</a></li> +</ul> +<p class="caption"><span class="caption-text">Development</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/schedule.html">Development Schedule</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/how-contribute.html">How to Contribute to SINGA</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/how-contribute.html#how-to-become-a-singa-committer">How to become a SINGA committer</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/contribute-code.html">How to Contribute Code</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/contribute-docs.html">How to Contribute to Documentation</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/how-to-release.html">How to prepare a release</a></li> +</ul> +<p class="caption"><span class="caption-text">Community</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../../../community/source-repository.html">Source Repository</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../community/mail-lists.html">Project Mailing Lists</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../community/issue-tracking.html">Issue Tracking</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../community/team-list.html">The SINGA Team</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">incubator-singa</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">Docs</a> »</li> + + <li>Use parameters pre-trained from Caffe in SINGA</li> + + + <li class="wy-breadcrumbs-aside"> + + + + </li> + + </ul> + + + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--><div class="section" id="use-parameters-pre-trained-from-caffe-in-singa"> +<h1>Use parameters pre-trained from Caffe in SINGA<a class="headerlink" href="#use-parameters-pre-trained-from-caffe-in-singa" title="Permalink to this headline">¶</a></h1> +<p>In this example, we use SINGA to load the VGG parameters trained by Caffe to do image classification.</p> +<div class="section" id="run-this-example"> +<h2>Run this example<a class="headerlink" href="#run-this-example" title="Permalink to this headline">¶</a></h2> +<p>You can run this example by simply executing <code class="docutils literal notranslate"><span class="pre">run.sh</span> <span class="pre">vgg16</span></code> or <code class="docutils literal notranslate"><span class="pre">run.sh</span> <span class="pre">vgg19</span></code> +The script does the following work.</p> +<div class="section" id="obtain-the-caffe-model"> +<h3>Obtain the Caffe model<a class="headerlink" href="#obtain-the-caffe-model" title="Permalink to this headline">¶</a></h3> +<ul class="simple"> +<li><p>Download caffe model prototxt and parameter binary file.</p></li> +<li><p>Currently we only support the latest caffe format, if your model is in +previous version of caffe, please update it to current format.(This is +supported by caffe)</p></li> +<li><p>After updating, we can obtain two files, i.e., the prototxt and parameter +binary file.</p></li> +</ul> +</div> +<div class="section" id="prepare-test-images"> +<h3>Prepare test images<a class="headerlink" href="#prepare-test-images" title="Permalink to this headline">¶</a></h3> +<p>A few sample images are downloaded into the <code class="docutils literal notranslate"><span class="pre">test</span></code> folder.</p> +</div> +<div class="section" id="predict"> +<h3>Predict<a class="headerlink" href="#predict" title="Permalink to this headline">¶</a></h3> +<p>The <code class="docutils literal notranslate"><span class="pre">predict.py</span></code> script creates the VGG model and read the parameters,</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">usage</span><span class="p">:</span> <span class="n">predict</span><span class="o">.</span><span class="n">py</span> <span class="p">[</span><span class="o">-</span><span class="n">h</span><span class="p">]</span> <span class="n">model_txt</span> <span class="n">model_bin</span> <span class="n">imgclass</span> +</pre></div> +</div> +<p>where <code class="docutils literal notranslate"><span class="pre">imgclass</span></code> refers to the synsets of imagenet dataset for vgg models. +You can start the prediction program by executing the following command:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="n">predict</span><span class="o">.</span><span class="n">py</span> <span class="n">vgg16</span><span class="o">.</span><span class="n">prototxt</span> <span class="n">vgg16</span><span class="o">.</span><span class="n">caffemodel</span> <span class="n">synset_words</span><span class="o">.</span><span class="n">txt</span> +</pre></div> +</div> +<p>Then you type in the image path, and the program would output the top-5 labels.</p> +<p>More Caffe models would be tested soon.</p> +</div> +</div> +</div> + + + </div> + + </div> + <footer> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2019 The Apache Software Foundation. All rights reserved. Apache SINGA, Apache, the Apache feather logo, and the Apache SINGA project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. + + </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> + + + + + + +<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> + <span class="rst-current-version" data-toggle="rst-current-version"> + <span class="fa fa-book"> incubator-singa </span> + v: latest + <span class="fa fa-caret-down"></span> + </span> + <div class="rst-other-versions"> + <dl> + <dt>Languages</dt> + <dd><a href="../../../../en/index.html">English</a></dd> + <dd><a href="../../../../zh/index.html">䏿</a></dd> + </dl> + <dl> + <dt>Versions</dt> + <dd><a href="http://singa.apache.org/v0.3.0/">0.3</a></dd> + <dd><a href="http://singa.apache.org/v1.1.0/">1.1</a></dd> + </dl> + + </div> + <a href="http://incubator.apache.org/"> <img src= "../../../_static/apache.png" style="background-color:white;"> </a> + + <a href="https://github.com/apache/incubator-singa" class="fa fa-github" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://aws.amazon.com/marketplace/seller-profile?id=5bcac385-12c4-4802-aec7-351e09b77b4c" class="fab fa-aws" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://hub.docker.com/r/apache/singa/" class="fab fa-docker" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.linkedin.com/groups/13550034" class="fa fa-linkedin" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://twitter.com/ApacheSinga" class="fa fa-twitter" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.facebook.com/Apache-SINGA-347284219056544/" class="fa fa-facebook" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.researchgate.net/project/Apache-SINGA" class="fab fa-researchgate" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + +</div> + + <a href="https://github.com/apache/incubator-singa"> + <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;" + src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" + alt="Fork me on GitHub"> +</a> + + + + +</body> +</html> \ No newline at end of file Added: incubator/singa/site/trunk/en/docs/model_zoo/char-rnn/README.html URL: http://svn.apache.org/viewvc/incubator/singa/site/trunk/en/docs/model_zoo/char-rnn/README.html?rev=1858059&view=auto ============================================================================== --- incubator/singa/site/trunk/en/docs/model_zoo/char-rnn/README.html (added) +++ incubator/singa/site/trunk/en/docs/model_zoo/char-rnn/README.html Wed Apr 24 14:57:35 2019 @@ -0,0 +1,388 @@ + + + +<!DOCTYPE html> +<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> +<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> +<head> + <meta charset="utf-8"> + + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + + <title>Train Char-RNN over plain text — incubator-singa 1.1.0 documentation</title> + + + + + + + + + <script type="text/javascript" src="../../../_static/js/modernizr.min.js"></script> + + + <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script> + <script type="text/javascript" src="../../../_static/jquery.js"></script> + <script type="text/javascript" src="../../../_static/underscore.js"></script> + <script type="text/javascript" src="../../../_static/doctools.js"></script> + <script type="text/javascript" src="../../../_static/language_data.js"></script> + + <script type="text/javascript" src="../../../_static/js/theme.js"></script> + + + + + <link rel="stylesheet" href="../../../_static/css/theme.css" type="text/css" /> + <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> + <link rel="index" title="Index" href="../../../genindex.html" /> + <link rel="search" title="Search" href="../../../search.html" /> + <link rel="next" title="Train a RBM model against MNIST dataset" href="../mnist/README.html" /> + <link rel="prev" title="Train CNN over Cifar-10" href="../cifar10/README.html" /> + <link href="../../../_static/style.css" rel="stylesheet" type="text/css"> + <!--link href="../../../_static/fontawesome-all.min.css" rel="stylesheet" type="text/css"--> + <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous"> + <style> + .fa:hover { + opacity: 0.7; + } + .fab:hover { + opacity: 0.7; + } + </style> + +</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"> incubator-singa + + + + + <img src="../../../_static/singa.png" class="logo" alt="Logo"/> + + </a> + + + + + <div class="version"> + latest + </div> + + + + +<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"> + + + + + + + <ul class="current"> +<li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Documentation</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="../../installation.html">Installation</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../software_stack.html">Software Stack</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../device.html">Device</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../tensor.html">Tensor</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../layer.html">Layer</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../net.html">FeedForward Net</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../initializer.html">Initializer</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../loss.html">Loss</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../metric.html">Metric</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../optimizer.html">Optimizer</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../autograd.html">Autograd in Singa</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../data.html">Data</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../image_tool.html">Image Tool</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../snapshot.html">Snapshot</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../converter.html">Caffe Converter</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../utils.html">Utils</a></li> +<li class="toctree-l2 current"><a class="reference internal" href="../index.html">Model Zoo</a><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="../cifar10/README.html">Train CNN over Cifar-10</a></li> +<li class="toctree-l3 current"><a class="current reference internal" href="#">Train Char-RNN over plain text</a><ul> +<li class="toctree-l4"><a class="reference internal" href="#instructions">Instructions</a></li> +</ul> +</li> +<li class="toctree-l3"><a class="reference internal" href="../mnist/README.html">Train a RBM model against MNIST dataset</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/alexnet/README.html">Train AlexNet over ImageNet</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/densenet/README.html">name: DenseNet models on ImageNet +SINGA version: 1.1.1 +SINGA commit: +license: https://github.com/pytorch/vision/blob/master/torchvision/models/densenet.py</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/densenet/README.html#image-classification-using-densenet">Image Classification using DenseNet</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/googlenet/README.html">name: GoogleNet on ImageNet +SINGA version: 1.0.1 +SINGA commit: 8c990f7da2de220e8a012c6a8ecc897dc7532744 +parameter_url: https://s3-ap-southeast-1.amazonaws.com/dlfile/bvlc_googlenet.tar.gz +parameter_sha1: 0a88e8948b1abca3badfd8d090d6be03f8d7655d +license: unrestricted https://github.com/BVLC/caffe/tree/master/models/bvlc_googlenet</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/googlenet/README.html#image-classification-using-googlenet">Image Classification using GoogleNet</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/inception/README.html">name: Inception V4 on ImageNet +SINGA version: 1.1.1 +SINGA commit: +parameter_url: https://s3-ap-southeast-1.amazonaws.com/dlfile/inception_v4.tar.gz +parameter_sha1: 5fdd6f5d8af8fd10e7321d9b38bb87ef14e80d56 +license: https://github.com/tensorflow/models/tree/master/slim</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/inception/README.html#image-classification-using-inception-v4">Image Classification using Inception V4</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/resnet/README.html">name: Resnets on ImageNet +SINGA version: 1.1 +SINGA commit: 45ec92d8ffc1fa1385a9307fdf07e21da939ee2f +parameter_url: https://s3-ap-southeast-1.amazonaws.com/dlfile/resnet/resnet-18.tar.gz +license: Apache V2, https://github.com/facebook/fb.resnet.torch/blob/master/LICENSE</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/resnet/README.html#image-classification-using-residual-networks">Image Classification using Residual Networks</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/vgg/README.html">name: VGG models on ImageNet +SINGA version: 1.1.1 +SINGA commit: +license: https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py</a></li> +<li class="toctree-l3"><a class="reference internal" href="../imagenet/vgg/README.html#image-classification-using-vgg">Image Classification using VGG</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="../../security.html">Security</a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../../../downloads.html">Download SINGA</a></li> +</ul> +<p class="caption"><span class="caption-text">Development</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/schedule.html">Development Schedule</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/how-contribute.html">How to Contribute to SINGA</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/how-contribute.html#how-to-become-a-singa-committer">How to become a SINGA committer</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/contribute-code.html">How to Contribute Code</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/contribute-docs.html">How to Contribute to Documentation</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../develop/how-to-release.html">How to prepare a release</a></li> +</ul> +<p class="caption"><span class="caption-text">Community</span></p> +<ul> +<li class="toctree-l1"><a class="reference internal" href="../../../community/source-repository.html">Source Repository</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../community/mail-lists.html">Project Mailing Lists</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../community/issue-tracking.html">Issue Tracking</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../community/team-list.html">The SINGA Team</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">incubator-singa</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">Docs</a> »</li> + + <li><a href="../../index.html">Documentation</a> »</li> + + <li><a href="../index.html">Model Zoo</a> »</li> + + <li>Train Char-RNN over plain text</li> + + + <li class="wy-breadcrumbs-aside"> + + + + </li> + + </ul> + + + <hr/> +</div> + <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> + <div itemprop="articleBody"> + + <!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--><div class="section" id="train-char-rnn-over-plain-text"> +<h1>Train Char-RNN over plain text<a class="headerlink" href="#train-char-rnn-over-plain-text" title="Permalink to this headline">¶</a></h1> +<p>Recurrent neural networks (RNN) are widely used for modelling sequential data, +e.g., natural language sentences. This example describes how to implement a RNN +application (or model) using SINGAâs RNN layers. +We will use the <a class="reference external" href="https://github.com/karpathy/char-rnn">char-rnn</a> model as an +example, which trains over sentences or +source code, with each character as an input unit. Particularly, we will train +a RNN using GRU over Linux kernel source code. After training, we expect to +generate meaningful code from the model.</p> +<div class="section" id="instructions"> +<h2>Instructions<a class="headerlink" href="#instructions" title="Permalink to this headline">¶</a></h2> +<ul> +<li><p>Compile and install SINGA. Currently the RNN implementation depends on Cudnn with version >= 5.05.</p></li> +<li><p>Prepare the dataset. Download the <a class="reference external" href="http://cs.stanford.edu/people/karpathy/char-rnn/">kernel source code</a>. +Other plain text files can also be used.</p></li> +<li><p>Start the training,</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">python</span> <span class="n">train</span><span class="o">.</span><span class="n">py</span> <span class="n">linux_input</span><span class="o">.</span><span class="n">txt</span> +</pre></div> +</div> +<p>Some hyper-parameters could be set through command line,</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">python</span> <span class="n">train</span><span class="o">.</span><span class="n">py</span> <span class="o">-</span><span class="n">h</span> +</pre></div> +</div> +</li> +<li><p>Sample characters from the model by providing the number of characters to sample and the seed string.</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span> <span class="n">python</span> <span class="n">sample</span><span class="o">.</span><span class="n">py</span> <span class="s1">'model.bin'</span> <span class="mi">100</span> <span class="o">--</span><span class="n">seed</span> <span class="s1">'#include <std'</span> +</pre></div> +</div> +<p>Please replace âmodel.binâ with the path to one of the checkpoint paths.</p> +</li> +</ul> +</div> +</div> + + + </div> + + </div> + <footer> + + <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> + + <a href="../mnist/README.html" class="btn btn-neutral float-right" title="Train a RBM model against MNIST dataset" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> + + + <a href="../cifar10/README.html" class="btn btn-neutral float-left" title="Train CNN over Cifar-10" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> + + </div> + + + <hr/> + + <div role="contentinfo"> + <p> + © Copyright 2019 The Apache Software Foundation. All rights reserved. Apache SINGA, Apache, the Apache feather logo, and the Apache SINGA project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners. + + </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> + + + + + + +<div class="rst-versions" data-toggle="rst-versions" role="note" aria-label="versions"> + <span class="rst-current-version" data-toggle="rst-current-version"> + <span class="fa fa-book"> incubator-singa </span> + v: latest + <span class="fa fa-caret-down"></span> + </span> + <div class="rst-other-versions"> + <dl> + <dt>Languages</dt> + <dd><a href="../../../../en/index.html">English</a></dd> + <dd><a href="../../../../zh/index.html">䏿</a></dd> + </dl> + <dl> + <dt>Versions</dt> + <dd><a href="http://singa.apache.org/v0.3.0/">0.3</a></dd> + <dd><a href="http://singa.apache.org/v1.1.0/">1.1</a></dd> + </dl> + + </div> + <a href="http://incubator.apache.org/"> <img src= "../../../_static/apache.png" style="background-color:white;"> </a> + + <a href="https://github.com/apache/incubator-singa" class="fa fa-github" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://aws.amazon.com/marketplace/seller-profile?id=5bcac385-12c4-4802-aec7-351e09b77b4c" class="fab fa-aws" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://hub.docker.com/r/apache/singa/" class="fab fa-docker" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.linkedin.com/groups/13550034" class="fa fa-linkedin" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://twitter.com/ApacheSinga" class="fa fa-twitter" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.facebook.com/Apache-SINGA-347284219056544/" class="fa fa-facebook" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + <a href="https://www.researchgate.net/project/Apache-SINGA" class="fab fa-researchgate" style="padding: 10px; font-size: 20px; width: 30px; text-align: center; text-decoration: none; margin: 5px 2px;"></a> + +</div> + + <a href="https://github.com/apache/incubator-singa"> + <img style="position: absolute; top: 0; right: 0; border: 0; z-index: 10000;" + src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" + alt="Fork me on GitHub"> +</a> + + + + +</body> +</html> \ No newline at end of file
