blob: 30f5a536235da3e6e547268ab9d9bc238a8373e7 [file] [log] [blame]
<!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>Tensor &mdash; incubator-singa 1.1.0 documentation</title>
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="top" title="incubator-singa 1.1.0 documentation" href="../index.html"/>
<link rel="up" title="Documentation" href="index.html"/>
<link rel="next" title="Layer" href="layer.html"/>
<link rel="prev" title="Device" href="device.html"/>
<link href="../_static/style.css" rel="stylesheet" type="text/css">
<script src="../_static/js/modernizr.min.js"></script>
</head>
<body class="wy-body-for-nav" role="document">
<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" />
</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"><a class="reference internal" href="../downloads.html">Download SINGA</a></li>
<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 current"><a class="current reference internal" href="">Tensor</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#tensor-implementation">Tensor implementation</a></li>
<li class="toctree-l3"><a class="reference internal" href="#module-singa.tensor">Python API</a></li>
<li class="toctree-l3"><a class="reference internal" href="#cpp-api">CPP API</a></li>
</ul>
</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="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>
</ul>
</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/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>
</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" role="navigation" 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> &raquo;</li>
<li><a href="index.html">Documentation</a> &raquo;</li>
<li>Tensor</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="tensor">
<h1>Tensor<a class="headerlink" href="#tensor" title="Permalink to this headline"></a></h1>
<p>Each Tensor instance is a multi-dimensional array allocated on a specific
Device instance. Tensor instances store variables and provide
linear algebra operations over different types of hardware devices without user
awareness. Note that users need to make sure the tensor operands are
allocated on the same device except copy functions.</p>
<div class="section" id="tensor-implementation">
<h2>Tensor implementation<a class="headerlink" href="#tensor-implementation" title="Permalink to this headline"></a></h2>
<p>SINGA has three different sets of implmentations of Tensor functions, one for each
type of Device.</p>
<ul class="simple">
<li>&#8216;tensor_math_cpp.h&#8217; implements operations using Cpp (with CBLAS) for CppGPU devices.</li>
<li>&#8216;tensor_math_cuda.h&#8217; implements operations using Cuda (with cuBLAS) for CudaGPU devices.</li>
<li>&#8216;tensor_math_opencl.h&#8217; implements operations using OpenCL for OpenclGPU devices.</li>
</ul>
</div>
<div class="section" id="module-singa.tensor">
<span id="python-api"></span><h2>Python API<a class="headerlink" href="#module-singa.tensor" title="Permalink to this headline"></a></h2>
<p>Example usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">singa</span> <span class="kn">import</span> <span class="n">tensor</span>
<span class="kn">from</span> <span class="nn">singa</span> <span class="kn">import</span> <span class="n">device</span>
<span class="c1"># create a tensor with shape (2,3), default CppCPU device and float32</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">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">))</span>
<span class="n">x</span><span class="o">.</span><span class="n">set_value</span><span class="p">(</span><span class="mf">0.4</span><span class="p">)</span>
<span class="c1"># create a tensor from a numpy array</span>
<span class="n">npy</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">3</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">float32</span><span class="p">)</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">npy</span><span class="p">)</span>
<span class="n">y</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span> <span class="c1"># sample values from the uniform distribution</span>
<span class="n">z</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">mult</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"># gemm -&gt; z of shape (2, 3)</span>
<span class="n">x</span> <span class="o">+=</span> <span class="n">z</span> <span class="c1"># element-wise addition</span>
<span class="n">dev</span> <span class="o">=</span> <span class="n">device</span><span class="o">.</span><span class="n">get_default_device</span><span class="p">()</span>
<span class="n">x</span><span class="o">.</span><span class="n">to_device</span><span class="p">(</span><span class="n">dev</span><span class="p">)</span> <span class="c1"># move the data to a gpu device</span>
<span class="n">r</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">relu</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="n">s</span> <span class="o">=</span> <span class="n">tensor</span><span class="o">.</span><span class="n">to_numpy</span><span class="p">(</span><span class="n">r</span><span class="p">)</span> <span class="c1"># tensor -&gt; numpy array</span>
</pre></div>
</div>
<p>There are two sets of tensor functions,</p>
<dl class="docutils">
<dt>Tensor member functions</dt>
<dd>which would change the internal state of the Tensor instance.</dd>
<dt>Tensor module functions</dt>
<dd>which accept Tensor instances as arguments and return Tensor instances.</dd>
</dl>
<p>Every Tesor instance must be initialized before reading data from it.</p>
<dl class="class">
<dt id="singa.tensor.Tensor">
<em class="property">class </em><code class="descclassname">singa.tensor.</code><code class="descname">Tensor</code><span class="sig-paren">(</span><em>shape=None</em>, <em>device=None</em>, <em>dtype=0</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor" title="Permalink to this definition"></a></dt>
<dd><p>Create a Py Tensor, which wraps a swig converted Tensor from CPP Tensor</p>
<p>The three arguments are three attributes of the Tensor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>shape</strong> (<em>list&lt;int&gt;</em>) &#8211; a list of integers for the tensor shape. If shape is
not specified, the created tensor is called a dummy tensor.</li>
<li><strong>device</strong> &#8211; a swig converted Device instance using the device moduel . If it
is None, then the default host device would be used.</li>
<li><strong>dtype</strong> &#8211; data type. currently, most operations only accept kFloat32.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="singa.tensor.Tensor.T">
<code class="descname">T</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.T" title="Permalink to this definition"></a></dt>
<dd><p>shallow copy, negate the transpose field.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor which shares the underlying data memory (shallow copy)
but is marked as a transposed version of this tensor.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.__iadd__">
<code class="descname">__iadd__</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.__iadd__" title="Permalink to this definition"></a></dt>
<dd><p>inplace element-wise addition with a tensor or a float value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>x</strong> (<em>float or Tensor</em>) &#8211; </td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.__idiv__">
<code class="descname">__idiv__</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.__idiv__" title="Permalink to this definition"></a></dt>
<dd><p>inplace element-wise division by a tensor or a float value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>x</strong> (<em>float or Tensor</em>) &#8211; </td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.__imul__">
<code class="descname">__imul__</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.__imul__" title="Permalink to this definition"></a></dt>
<dd><p>inplace element-wise multiplication with a tensor or a float value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>x</strong> (<em>float or Tensor</em>) &#8211; </td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.__isub__">
<code class="descname">__isub__</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.__isub__" title="Permalink to this definition"></a></dt>
<dd><p>inplace element-wise subtraction with a tensor or a float value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>x</strong> (<em>float or Tensor</em>) &#8211; </td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.add_column">
<code class="descname">add_column</code><span class="sig-paren">(</span><em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.add_column" title="Permalink to this definition"></a></dt>
<dd><p>Add a tensor to each column of this tensor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; a Tensor to be added as a column to this tensor.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.add_row">
<code class="descname">add_row</code><span class="sig-paren">(</span><em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.add_row" title="Permalink to this definition"></a></dt>
<dd><p>Add a tensor to each row of this tensor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; a Tensor to be added as a row to this tensor.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.bernoulli">
<code class="descname">bernoulli</code><span class="sig-paren">(</span><em>p</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.bernoulli" title="Permalink to this definition"></a></dt>
<dd><p>Sample 0/1 for each element according to the given probability.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>p</strong> (<em>float</em>) &#8211; with probability p, each element is sample to 1.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.clone">
<code class="descname">clone</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.clone" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor which does deep copy of this tensor</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.copy" title="Permalink to this definition"></a></dt>
<dd><p>shallow copy calls copy constructor of singa::Tensor</p>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.copy_data">
<code class="descname">copy_data</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.copy_data" title="Permalink to this definition"></a></dt>
<dd><p>Copy data from other Tensor instance.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; source Tensor.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.copy_from_numpy">
<code class="descname">copy_from_numpy</code><span class="sig-paren">(</span><em>np_array</em>, <em>offset=0</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.copy_from_numpy" title="Permalink to this definition"></a></dt>
<dd><p>Copy the data from the numpy array.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>np_array</strong> &#8211; source numpy array</li>
<li><strong>offset</strong> (<em>int</em>) &#8211; destination offset</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.deepcopy">
<code class="descname">deepcopy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.deepcopy" title="Permalink to this definition"></a></dt>
<dd><p>Same as clone().</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.div_column">
<code class="descname">div_column</code><span class="sig-paren">(</span><em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.div_column" title="Permalink to this definition"></a></dt>
<dd><p>Divide each column of this tensor by v.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; 1d tensor of the same length the column of self.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.div_row">
<code class="descname">div_row</code><span class="sig-paren">(</span><em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.div_row" title="Permalink to this definition"></a></dt>
<dd><p>Divide each row of this tensor by v.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; 1d tensor of the same length the row of self.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.gaussian">
<code class="descname">gaussian</code><span class="sig-paren">(</span><em>mean</em>, <em>std</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.gaussian" title="Permalink to this definition"></a></dt>
<dd><p>Generate a value for each element following a Gaussian distribution.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>mean</strong> (<em>float</em>) &#8211; mean of the distribution</li>
<li><strong>std</strong> (<em>float</em>) &#8211; standard variance of the distribution</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.is_empty">
<code class="descname">is_empty</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.is_empty" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if the tensor is empty according to its shape</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.is_transpose">
<code class="descname">is_transpose</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.is_transpose" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if the internal data is transposed; otherwise False.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.l1">
<code class="descname">l1</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.l1" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the L1 norm.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.l2">
<code class="descname">l2</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.l2" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the L2 norm.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.memsize">
<code class="descname">memsize</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.memsize" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the number of Bytes allocated for this tensor.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.mult_column">
<code class="descname">mult_column</code><span class="sig-paren">(</span><em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.mult_column" title="Permalink to this definition"></a></dt>
<dd><p>Multiply each column of this tensor by v element-wisely.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; 1d tensor of the same length the column of self.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.mult_row">
<code class="descname">mult_row</code><span class="sig-paren">(</span><em>v</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.mult_row" title="Permalink to this definition"></a></dt>
<dd><p>Multiply each row of this tensor by v element-wisely.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; 1d tensor of the same length the row of self.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.ndim">
<code class="descname">ndim</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.ndim" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the number of dimensions of the tensor.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.reset_like">
<code class="descname">reset_like</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.reset_like" title="Permalink to this definition"></a></dt>
<dd><p>Reset the shape, dtype and device as the given tensor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.reshape">
<code class="descname">reshape</code><span class="sig-paren">(</span><em>shape</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.reshape" title="Permalink to this definition"></a></dt>
<dd><p>Change the tensor shape.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>shape</strong> (<em>list&lt;int&gt;</em>) &#8211; new shape, which should have the same volumn as
the original shape.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.set_value">
<code class="descname">set_value</code><span class="sig-paren">(</span><em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.set_value" title="Permalink to this definition"></a></dt>
<dd><p>Set all elements of the tensor to be the give value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>x</strong> (<em>float</em>) &#8211; </td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.size">
<code class="descname">size</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.size" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the number of elements of the tensor.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.to_device">
<code class="descname">to_device</code><span class="sig-paren">(</span><em>device</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.to_device" title="Permalink to this definition"></a></dt>
<dd><p>Move the tensor data onto a given device.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>device</strong> &#8211; a swig Device converted from CudaGPU or CppCPU or OpenclGPU</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.to_host">
<code class="descname">to_host</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.to_host" title="Permalink to this definition"></a></dt>
<dd><p>Move the tensor data onto the default host CppCPU device.</p>
</dd></dl>
<dl class="method">
<dt id="singa.tensor.Tensor.uniform">
<code class="descname">uniform</code><span class="sig-paren">(</span><em>low</em>, <em>high</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.Tensor.uniform" title="Permalink to this definition"></a></dt>
<dd><p>Generate a value for each element following a uniform distribution.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>low</strong> (<em>float</em>) &#8211; the lower bound</li>
<li><strong>high</strong> (<em>float</em>) &#8211; the hight bound</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.abs">
<code class="descclassname">singa.tensor.</code><code class="descname">abs</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.abs" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = abs(x), x is an element of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.add">
<code class="descclassname">singa.tensor.</code><code class="descname">add</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em>, <em>ret=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.add" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise addition.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>lhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>rhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>ret</strong> (<em>Tensor, optional</em>) &#8211; if not None, the result is stored in it;
otherwise, a new Tensor would be created for the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the result Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.add_column">
<code class="descclassname">singa.tensor.</code><code class="descname">add_column</code><span class="sig-paren">(</span><em>alpha</em>, <em>v</em>, <em>beta</em>, <em>M</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.add_column" title="Permalink to this definition"></a></dt>
<dd><p>Add v to each column of M.</p>
<p>Denote each column of M as m, m = alpha * v + beta * m</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>alpha</strong> (<em>float</em>) &#8211; </li>
<li><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>beta</strong> (<em>float</em>) &#8211; </li>
<li><strong>M</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; 2d tensor</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">M</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.add_row">
<code class="descclassname">singa.tensor.</code><code class="descname">add_row</code><span class="sig-paren">(</span><em>alpha</em>, <em>v</em>, <em>beta</em>, <em>M</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.add_row" title="Permalink to this definition"></a></dt>
<dd><p>Add v to each row of M.</p>
<p>Denote each row of M as m, m = alpha * v + beta * m</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>alpha</strong> (<em>float</em>) &#8211; </li>
<li><strong>v</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>beta</strong> (<em>float</em>) &#8211; </li>
<li><strong>M</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; 2d tensor</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">M</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.average">
<code class="descclassname">singa.tensor.</code><code class="descname">average</code><span class="sig-paren">(</span><em>t</em>, <em>axis=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.average" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</li>
<li><strong>axis</strong> (<em>int, optional</em>) &#8211; if None, average all elements; otherwise average
along the given dimension. 0 for averaging each column; 1 for
averaging each row.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a float value if axis is None; otherwise, a new Tensor for the result.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.axpy">
<code class="descclassname">singa.tensor.</code><code class="descname">axpy</code><span class="sig-paren">(</span><em>alpha</em>, <em>x</em>, <em>y</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.axpy" title="Permalink to this definition"></a></dt>
<dd><p>Element-wise operation for y += alpha * x.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>alpha</strong> (<em>float</em>) &#8211; </li>
<li><strong>x</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>y</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">y</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.bernoulli">
<code class="descclassname">singa.tensor.</code><code class="descname">bernoulli</code><span class="sig-paren">(</span><em>p</em>, <em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.bernoulli" title="Permalink to this definition"></a></dt>
<dd><p>Generate a binary value for each element of t.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>p</strong> (<em>float</em>) &#8211; each element is 1 with probability p; and 0 with 1 - p</li>
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; the results are put into t</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">t</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.copy_data_to_from">
<code class="descclassname">singa.tensor.</code><code class="descname">copy_data_to_from</code><span class="sig-paren">(</span><em>dst</em>, <em>src</em>, <em>size</em>, <em>dst_offset=0</em>, <em>src_offset=0</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.copy_data_to_from" title="Permalink to this definition"></a></dt>
<dd><p>Copy the data between two Tensor instances which could be on different
devices.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>dst</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; destination Tensor</li>
<li><strong>src</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; source Tensor</li>
<li><strong>size</strong> (<em>int</em>) &#8211; number of elements to copy</li>
<li><strong>dst_offset</strong> (<em>int</em>) &#8211; offset in terms of elements to the start of dst</li>
<li><strong>src_offset</strong> (<em>int</em>) &#8211; offset in terms of elements to the start of src</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.div">
<code class="descclassname">singa.tensor.</code><code class="descname">div</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em>, <em>ret=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.div" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise division.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>lhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>rhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>ret</strong> (<em>Tensor, optional</em>) &#8211; if not None, the result is stored in it;
otherwise, a new Tensor would be created for the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the result Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.eltwise_mult">
<code class="descclassname">singa.tensor.</code><code class="descname">eltwise_mult</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em>, <em>ret=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.eltwise_mult" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise multiplication.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>lhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>rhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>ret</strong> (<em>Tensor, optional</em>) &#8211; if not None, the result is stored in it;
otherwise, a new Tensor would be created for the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the result Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.exp">
<code class="descclassname">singa.tensor.</code><code class="descname">exp</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.exp" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = exp(x), x is an element of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.from_numpy">
<code class="descclassname">singa.tensor.</code><code class="descname">from_numpy</code><span class="sig-paren">(</span><em>np_array</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.from_numpy" title="Permalink to this definition"></a></dt>
<dd><p>Create a Tensor instance with the shape, dtype and values from the numpy
array.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>np_array</strong> &#8211; the numpy array.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A Tensor instance allocated on the default CppCPU device.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.gaussian">
<code class="descclassname">singa.tensor.</code><code class="descname">gaussian</code><span class="sig-paren">(</span><em>mean</em>, <em>std</em>, <em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.gaussian" title="Permalink to this definition"></a></dt>
<dd><p>Generate values following a Gaussian distribution.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mean</strong> (<em>float</em>) &#8211; the mean of the Gaussian distribution.</li>
<li><strong>std</strong> (<em>float</em>) &#8211; the standard variance of the Gaussian distribution.</li>
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; the results are put into t</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">t</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.ge">
<code class="descclassname">singa.tensor.</code><code class="descname">ge</code><span class="sig-paren">(</span><em>t</em>, <em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.ge" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise comparison for t &gt;= x.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; left hand side operand</li>
<li><strong>x</strong> (<em>Tensor or float</em>) &#8211; right hand side operand</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">0.0f,
or t[i] &gt;= x[i] ? 1.0f:0.0f</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">a Tensor with each element being t[i] &gt;= x ? 1.0f</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.gt">
<code class="descclassname">singa.tensor.</code><code class="descname">gt</code><span class="sig-paren">(</span><em>t</em>, <em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.gt" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise comparison for t &gt; x.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; left hand side operand</li>
<li><strong>x</strong> (<em>Tensor or float</em>) &#8211; right hand side operand</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">0.0f,
or t[i] &gt; x[i] ? 1.0f:0.0f</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">a Tensor with each element being t[i] &gt; x ? 1.0f</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.le">
<code class="descclassname">singa.tensor.</code><code class="descname">le</code><span class="sig-paren">(</span><em>t</em>, <em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.le" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise comparison for t &lt;= x.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; left hand side operand</li>
<li><strong>x</strong> (<em>Tensor or float</em>) &#8211; right hand side operand</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">0.0f,
or t[i] &lt;= x[i] ? 1.0f:0.0f</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">a Tensor with each element being t[i] &lt;= x ? 1.0f</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.log">
<code class="descclassname">singa.tensor.</code><code class="descname">log</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.log" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = log(x), x is an element of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.lt">
<code class="descclassname">singa.tensor.</code><code class="descname">lt</code><span class="sig-paren">(</span><em>t</em>, <em>x</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.lt" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise comparison for t &lt; x</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; left hand side operand</li>
<li><strong>x</strong> (<em>Tensor or float</em>) &#8211; right hand side operand</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">0.0f,
or t[i] &lt; x[i] ? 1.0f:0.0f</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">a Tensor with each element being t[i] &lt; x ? 1.0f</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.mult">
<code class="descclassname">singa.tensor.</code><code class="descname">mult</code><span class="sig-paren">(</span><em>A</em>, <em>B</em>, <em>C=None</em>, <em>alpha=1.0</em>, <em>beta=0.0</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.mult" title="Permalink to this definition"></a></dt>
<dd><p>Do matrix-matrix or matrix-vector multiplication.</p>
<p>This function returns C = alpha * A * B + beta * C</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>A</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; 2d Tensor</li>
<li><strong>B</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; If B is a 1d Tensor, GEMV would be invoked for matrix-vector
multiplication; otherwise GEMM would be invoked.</li>
<li><strong>C</strong> (<em>Tensor, optional</em>) &#8211; for storing the result; If None, a new Tensor
would be created.</li>
<li><strong>alpha</strong> (<em>float</em>) &#8211; </li>
<li><strong>beta</strong> (<em>float</em>) &#8211; </li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the result Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.pow">
<code class="descclassname">singa.tensor.</code><code class="descname">pow</code><span class="sig-paren">(</span><em>t</em>, <em>x</em>, <em>out=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.pow" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input tensor</li>
<li><strong>x</strong> (<em>float or Tensor</em>) &#8211; y[i] = t[i]^x if x is a float value; otherwise,
y[i]= t[i]^x[i] if x is a tensor.</li>
<li><strong>out</strong> (<em>None or Tensor</em>) &#8211; if None, a new Tensor would be constructed to
store the result; otherwise, the result is put into out.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the result tensor.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.relu">
<code class="descclassname">singa.tensor.</code><code class="descname">relu</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.relu" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = x if x &gt;0; otherwise 0; x is an element
of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.reshape">
<code class="descclassname">singa.tensor.</code><code class="descname">reshape</code><span class="sig-paren">(</span><em>t</em>, <em>s</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.reshape" title="Permalink to this definition"></a></dt>
<dd><p>Reshape the input tensor with the given shape.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; the tensor to be changed</li>
<li><strong>s</strong> (<em>list&lt;int&gt;</em>) &#8211; the new shape, which should have the same volumn as the
old shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the new Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sigmoid">
<code class="descclassname">singa.tensor.</code><code class="descname">sigmoid</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sigmoid" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = sigmoid(x); x is an element of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sign">
<code class="descclassname">singa.tensor.</code><code class="descname">sign</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sign" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = sign(x)</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sizeof">
<code class="descclassname">singa.tensor.</code><code class="descname">sizeof</code><span class="sig-paren">(</span><em>dtype</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sizeof" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the number of bytes of the given SINGA data type defined in core.proto</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.softmax">
<code class="descclassname">singa.tensor.</code><code class="descname">softmax</code><span class="sig-paren">(</span><em>t</em>, <em>out=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.softmax" title="Permalink to this definition"></a></dt>
<dd><p>Apply SoftMax for each row of the Tensor.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; the input 1d or 2d tensor</li>
<li><strong>out</strong> (<em>Tensor, optional</em>) &#8211; if not None, it is used to store the result</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the result Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sqrt">
<code class="descclassname">singa.tensor.</code><code class="descname">sqrt</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sqrt" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = sqrt(x), x is an element of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.square">
<code class="descclassname">singa.tensor.</code><code class="descname">square</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.square" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = x * x, x is an element of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sub">
<code class="descclassname">singa.tensor.</code><code class="descname">sub</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em>, <em>ret=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sub" title="Permalink to this definition"></a></dt>
<dd><p>Elementi-wise subtraction.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>lhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>rhs</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </li>
<li><strong>ret</strong> (<em>Tensor, optional</em>) &#8211; if not None, the result is stored in it;
otherwise, a new Tensor would be created for the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the result Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sum">
<code class="descclassname">singa.tensor.</code><code class="descname">sum</code><span class="sig-paren">(</span><em>t</em>, <em>axis=None</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sum" title="Permalink to this definition"></a></dt>
<dd><p>Sum elements of the input tensor long the given axis.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</li>
<li><strong>axis</strong> (<em>int, optional</em>) &#8211; if None, the summation is done over all elements;
if axis is provided, then it is calculated along the given axis,
e.g. 0 &#8211; sum each column; 1 &#8211; sum each row.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a float value as the sum of all elements, or a new Tensor</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sum_columns">
<code class="descclassname">singa.tensor.</code><code class="descname">sum_columns</code><span class="sig-paren">(</span><em>M</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sum_columns" title="Permalink to this definition"></a></dt>
<dd><p>Sum all columns into a single column.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>M</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; the input 2d tensor.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor as the resulted column.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.sum_rows">
<code class="descclassname">singa.tensor.</code><code class="descname">sum_rows</code><span class="sig-paren">(</span><em>M</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.sum_rows" title="Permalink to this definition"></a></dt>
<dd><p>Sum all rows into a single row.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>M</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; the input 2d tensor.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor as the resulted row.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.tanh">
<code class="descclassname">singa.tensor.</code><code class="descname">tanh</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.tanh" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; input Tensor</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a new Tensor whose element y = tanh(x), x is an element of t</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.to_host">
<code class="descclassname">singa.tensor.</code><code class="descname">to_host</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.to_host" title="Permalink to this definition"></a></dt>
<dd><p>Copy the data to a host tensor.</p>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.to_numpy">
<code class="descclassname">singa.tensor.</code><code class="descname">to_numpy</code><span class="sig-paren">(</span><em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.to_numpy" title="Permalink to this definition"></a></dt>
<dd><p>Copy the tensor into a numpy array.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; </td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a numpy array</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="singa.tensor.uniform">
<code class="descclassname">singa.tensor.</code><code class="descname">uniform</code><span class="sig-paren">(</span><em>low</em>, <em>high</em>, <em>t</em><span class="sig-paren">)</span><a class="headerlink" href="#singa.tensor.uniform" title="Permalink to this definition"></a></dt>
<dd><p>Generate values following a Uniform distribution.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>low</strong> (<em>float</em>) &#8211; the lower bound</li>
<li><strong>hight</strong> (<em>float</em>) &#8211; the higher bound</li>
<li><strong>t</strong> (<a class="reference internal" href="#singa.tensor.Tensor" title="singa.tensor.Tensor"><em>Tensor</em></a>) &#8211; the results are put into t</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">t</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="cpp-api">
<h2>CPP API<a class="headerlink" href="#cpp-api" title="Permalink to this headline"></a></h2>
</div>
</div>
</div>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="layer.html" class="btn btn-neutral float-right" title="Layer" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="device.html" class="btn btn-neutral" title="Device" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2017 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/snide/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">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'../',
VERSION:'1.1.0',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true
};
</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/js/theme.js"></script>
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.StickyNav.enable();
});
</script>
<div class="rst-versions shift-up" 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.jpg"> </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>