blob: 3004a3ed26fb629e87283dbf1949e55d516a3e4d [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<title>NDArray API — mxnet documentation</title>
<link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="../../_static/basic.css" rel="stylesheet" type="text/css">
<link href="../../_static/pygments.css" rel="stylesheet" type="text/css">
<link href="../../_static/mxnet.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: ''
};
</script>
<script src="../../_static/jquery-1.11.1.js" type="text/javascript"></script>
<script src="../../_static/underscore.js" type="text/javascript"></script>
<script src="../../_static/searchtools_custom.js" type="text/javascript"></script>
<script src="../../_static/doctools.js" type="text/javascript"></script>
<script src="../../_static/selectlang.js" type="text/javascript"></script>
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
<script type="text/javascript"> jQuery(function() { Search.loadIndex("/searchindex.js"); Search.init();}); </script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new
Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-96378503-1', 'auto');
ga('send', 'pageview');
</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="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> -->
<!-- -->
<link href="index.html" rel="up" title="MXNet - Python API">
<link href="symbol.html" rel="next" title="Symbol API"/>
<link href="index.html" rel="prev" title="MXNet - Python API"/>
<link href="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-icon.png" rel="icon" type="image/png"/>
</link></link></link></head>
<body role="document"><!-- Previous Navbar Layout
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="../../" class="navbar-brand">
<img src="http://data.mxnet.io/theme/mxnet.png">
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul id="navbar" class="navbar navbar-left">
<li> <a href="../../get_started/index.html">Get Started</a> </li>
<li> <a href="../../tutorials/index.html">Tutorials</a> </li>
<li> <a href="../../how_to/index.html">How To</a> </li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">Packages <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../../packages/python/index.html">
Python
</a></li>
<li><a href="../../packages/r/index.html">
R
</a></li>
<li><a href="../../packages/julia/index.html">
Julia
</a></li>
<li><a href="../../packages/c++/index.html">
C++
</a></li>
<li><a href="../../packages/scala/index.html">
Scala
</a></li>
<li><a href="../../packages/perl/index.html">
Perl
</a></li>
</ul>
</li>
<li> <a href="../../system/index.html">System</a> </li>
<li>
<form class="" role="search" action="../../search.html" method="get" autocomplete="off">
<div class="form-group inner-addon left-addon">
<i class="glyphicon glyphicon-search"></i>
<input type="text" name="q" class="form-control" placeholder="Search">
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form> </li>
</ul>
<ul id="navbar" class="navbar navbar-right">
<li> <a href="../../index.html"><span class="flag-icon flag-icon-us"></span></a> </li>
<li> <a href="../..//zh/index.html"><span class="flag-icon flag-icon-cn"></span></a> </li>
</ul>
</div>
</div>
</div>
Previous Navbar Layout End -->
<div class="navbar navbar-fixed-top">
<div class="container" id="navContainer">
<div class="innder" id="header-inner">
<h1 id="logo-wrap">
<a href="../../" id="logo"><img src="http://data.mxnet.io/theme/mxnet.png"/></a>
</h1>
<nav class="nav-bar" id="main-nav">
<a class="main-nav-link" href="../../get_started/install.html">Install</a>
<a class="main-nav-link" href="../../tutorials/index.html">Tutorials</a>
<a class="main-nav-link" href="../../how_to/index.html">How To</a>
<span id="dropdown-menu-position-anchor">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">API <span class="caret"></span></a>
<ul class="dropdown-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="../../api/python/index.html">Python</a></li>
<li><a class="main-nav-link" href="../../api/scala/index.html">Scala</a></li>
<li><a class="main-nav-link" href="../../api/r/index.html">R</a></li>
<li><a class="main-nav-link" href="../../api/julia/index.html">Julia</a></li>
<li><a class="main-nav-link" href="../../api/c++/index.html">C++</a></li>
<li><a class="main-nav-link" href="../../api/perl/index.html">Perl</a></li>
</ul>
</span>
<a class="main-nav-link" href="../../architecture/index.html">Architecture</a>
<!-- <a class="main-nav-link" href="../../community/index.html">Community</a> -->
<a class="main-nav-link" href="https://github.com/dmlc/mxnet">Github</a>
<span id="dropdown-menu-position-anchor-version" style="position: relative"><a href="#" class="main-nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">Versions(master)<span class="caret"></span></a><ul id="package-dropdown-menu" class="dropdown-menu"><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/test/>v0.10.14</a></li><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/test/versions/0.10/index.html>0.10</a></li><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/test/versions/master/index.html>master</a></li></ul></span></nav>
<script> function getRootPath(){ return "../../" } </script>
<div class="burgerIcon dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"></a>
<ul class="dropdown-menu dropdown-menu-right" id="burgerMenu">
<li><a href="../../get_started/install.html">Install</a></li>
<li><a href="../../tutorials/index.html">Tutorials</a></li>
<li><a href="../../how_to/index.html">How To</a></li>
<li class="dropdown-submenu">
<a href="#" tabindex="-1">API</a>
<ul class="dropdown-menu">
<li><a href="../../api/python/index.html" tabindex="-1">Python</a>
</li>
<li><a href="../../api/scala/index.html" tabindex="-1">Scala</a>
</li>
<li><a href="../../api/r/index.html" tabindex="-1">R</a>
</li>
<li><a href="../../api/julia/index.html" tabindex="-1">Julia</a>
</li>
<li><a href="../../api/c++/index.html" tabindex="-1">C++</a>
</li>
<li><a href="../../api/perl/index.html" tabindex="-1">Perl</a>
</li>
</ul>
</li>
<li><a href="../../architecture/index.html">Architecture</a></li>
<li><a class="main-nav-link" href="https://github.com/dmlc/mxnet">Github</a></li>
<li id="dropdown-menu-position-anchor-version-mobile" class="dropdown-submenu" style="position: relative"><a href="#" tabindex="-1">Versions(master)</a><ul class="dropdown-menu"><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/test/>v0.10.14</a></li><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/test/versions/0.10/index.html>0.10</a></li><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/test/versions/master/index.html>master</a></li></ul></li></ul>
</div>
<div class="plusIcon dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"><span aria-hidden="true" class="glyphicon glyphicon-plus"></span></a>
<ul class="dropdown-menu dropdown-menu-right" id="plusMenu"></ul>
</div>
<div id="search-input-wrap">
<form action="../../search.html" autocomplete="off" class="" method="get" role="search">
<div class="form-group inner-addon left-addon">
<i class="glyphicon glyphicon-search"></i>
<input class="form-control" name="q" placeholder="Search" type="text"/>
</div>
<input name="check_keywords" type="hidden" value="yes">
<input name="area" type="hidden" value="default"/>
</input></form>
<div id="search-preview"></div>
</div>
<div id="searchIcon">
<span aria-hidden="true" class="glyphicon glyphicon-search"></span>
</div>
<!-- <div id="lang-select-wrap"> -->
<!-- <label id="lang-select-label"> -->
<!-- <\!-- <i class="fa fa-globe"></i> -\-> -->
<!-- <span></span> -->
<!-- </label> -->
<!-- <select id="lang-select"> -->
<!-- <option value="en">Eng</option> -->
<!-- <option value="zh">中文</option> -->
<!-- </select> -->
<!-- </div> -->
<!-- <a id="mobile-nav-toggle">
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
<span class="mobile-nav-toggle-bar"></span>
</a> -->
</div>
</div>
</div>
<div class="container">
<div class="row">
<div aria-label="main navigation" class="sphinxsidebar leftsidebar" role="navigation">
<div class="sphinxsidebarwrapper">
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Python Documents</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="index.html#table-of-contents">Table of contents</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="">NDArray API</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#overview">Overview</a></li>
<li class="toctree-l4"><a class="reference internal" href="#the-ndarray-class">The <code class="docutils literal"><span class="pre">NDArray</span></code> class</a></li>
<li class="toctree-l4"><a class="reference internal" href="#array-creation-routines">Array creation routines</a></li>
<li class="toctree-l4"><a class="reference internal" href="#array-manipulation-routines">Array manipulation routines</a></li>
<li class="toctree-l4"><a class="reference internal" href="#mathematical-functions">Mathematical functions</a></li>
<li class="toctree-l4"><a class="reference internal" href="#neural-network">Neural network</a></li>
<li class="toctree-l4"><a class="reference internal" href="#api-reference">API Reference</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="symbol.html">Symbol API</a></li>
<li class="toctree-l3"><a class="reference internal" href="module.html">Module API</a></li>
<li class="toctree-l3"><a class="reference internal" href="rnn.html">RNN Cell API</a></li>
<li class="toctree-l3"><a class="reference internal" href="kvstore.html">KVStore API</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html">Data Loading API</a></li>
<li class="toctree-l3"><a class="reference internal" href="optimization.html">Optimization: initialize and update weights</a></li>
<li class="toctree-l3"><a class="reference internal" href="callback.html">Callback API</a></li>
<li class="toctree-l3"><a class="reference internal" href="metric.html">Evaluation Metric API</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../r/index.html">R Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../julia/index.html">Julia Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../c++/index.html">C++ Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../scala/index.html">Scala Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../perl/index.html">Perl Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../how_to/index.html">HowTo Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/index.html">System Documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tutorials/index.html">Tutorials</a></li>
</ul>
</div>
</div>
<div class="content">
<div class="section" id="ndarray-api">
<span id="ndarray-api"></span><h1>NDArray API<a class="headerlink" href="#ndarray-api" title="Permalink to this headline"></a></h1>
<div class="section" id="overview">
<span id="overview"></span><h2>Overview<a class="headerlink" href="#overview" title="Permalink to this headline"></a></h2>
<p>This document lists the routines of the <em>n</em>-dimensional array package:</p>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#module-mxnet.ndarray" title="mxnet.ndarray"><code class="xref py py-obj docutils literal"><span class="pre">mxnet.ndarray</span></code></a></td>
<td>NDArray API of MXNet.</td>
</tr>
</tbody>
</table>
<p>The <code class="docutils literal"><span class="pre">NDArray</span></code> API, defined in the <code class="docutils literal"><span class="pre">ndarray</span></code> (or simply <code class="docutils literal"><span class="pre">nd</span></code>) package, provides
imperative tensor operations on CPU/GPU.
An <code class="docutils literal"><span class="pre">NDArray</span></code> represents a multi-dimensional, fixed-size homogenous array.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mi">1</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="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]])</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">x</span><span class="p">)</span>
<span class="go"><class 'mxnet.ndarray.NDArray'></span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(2, 3)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span> <span class="o">+</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span><span class="o">*</span><span class="mi">3</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span>
<span class="go">[[ 4. 5. 6.]</span>
<span class="go"> [ 7. 8. 9.]]</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">y</span><span class="o">.</span><span class="n">as_in_context</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">z</span><span class="p">)</span>
<span class="go"><NDArray 2x3 @gpu(0)></span>
</pre></div>
</div>
<p>A detailed tutorial is available at
<a class="reference external" href="http://mxnet.io/tutorials/basic/ndarray.html">NDArray - Imperative tensor operations on CPU/GPU</a>.
<br/><br/></p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p><code class="docutils literal"><span class="pre">mxnet.ndarray</span></code> is similar to <code class="docutils literal"><span class="pre">numpy.ndarray</span></code> in some aspects. But the differences are not negligible. For instance:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">mxnet.ndarray.NDArray.T</span></code> does real data transpose to return new a copied
array, instead of returning a view of the input array.</li>
<li><code class="docutils literal"><span class="pre">mxnet.ndarray.dot</span></code> performs dot product between the last axis of the
first input array and the first axis of the second input, while <cite>numpy.dot</cite>
uses the second last axis of the input array.</li>
</ul>
<p class="last">In addition, <code class="docutils literal"><span class="pre">mxnet.ndarray.NDArray</span></code> supports GPU computation and various neural
network layers.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p><code class="docutils literal"><span class="pre">ndarray</span></code> provides almost the same routines as <code class="docutils literal"><span class="pre">symbol</span></code>. Most
routines between these two packages share the source code. But <code class="docutils literal"><span class="pre">ndarray</span></code>
differs from <code class="docutils literal"><span class="pre">symbol</span></code> in few aspects:</p>
<ul class="last simple">
<li><code class="docutils literal"><span class="pre">ndarray</span></code> adopts imperative programming, namely sentences are executed
step-by-step so that the results can be obtained immediately whereas
<code class="docutils literal"><span class="pre">symbol</span></code> adopts declarative programming.</li>
<li>Most binary operators in <code class="docutils literal"><span class="pre">ndarray</span></code> such as <code class="docutils literal"><span class="pre">+</span></code> and <code class="docutils literal"><span class="pre">></span></code> have
broadcasting enabled by default.</li>
</ul>
</div>
<p>In the rest of this document, we first overview the methods provided by the
<code class="docutils literal"><span class="pre">ndarray.NDArray</span></code> class, and then list other routines provided by the
<code class="docutils literal"><span class="pre">ndarray</span></code> package.</p>
</div>
<div class="section" id="the-ndarray-class">
<span id="the-ndarray-class"></span><h2>The <code class="docutils literal"><span class="pre">NDArray</span></code> class<a class="headerlink" href="#the-ndarray-class" title="Permalink to this headline"></a></h2>
<div class="section" id="array-attributes">
<span id="array-attributes"></span><h3>Array attributes<a class="headerlink" href="#array-attributes" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.shape" title="mxnet.ndarray.NDArray.shape"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.shape</span></code></a></td>
<td>Tuple of array dimensions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.size" title="mxnet.ndarray.NDArray.size"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.size</span></code></a></td>
<td>Number of elements in the array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.context" title="mxnet.ndarray.NDArray.context"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.context</span></code></a></td>
<td>Device context of the array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.dtype" title="mxnet.ndarray.NDArray.dtype"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.dtype</span></code></a></td>
<td>Data-type of the array’s elements.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-conversion">
<span id="array-conversion"></span><h3>Array conversion<a class="headerlink" href="#array-conversion" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.copy" title="mxnet.ndarray.NDArray.copy"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.copy</span></code></a></td>
<td>Makes a copy of this <code class="docutils literal"><span class="pre">NDArray</span></code>, keeping the same context.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.copyto" title="mxnet.ndarray.NDArray.copyto"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.copyto</span></code></a></td>
<td>Copies the value of this array to another array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.as_in_context" title="mxnet.ndarray.NDArray.as_in_context"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.as_in_context</span></code></a></td>
<td>Returns an array on the target device with the same value as this array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.asnumpy" title="mxnet.ndarray.NDArray.asnumpy"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.asnumpy</span></code></a></td>
<td>Returns a <code class="docutils literal"><span class="pre">numpy.ndarray</span></code> object with value copied from this array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.asscalar" title="mxnet.ndarray.NDArray.asscalar"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.asscalar</span></code></a></td>
<td>Returns a scalar whose value is copied from this array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.astype" title="mxnet.ndarray.NDArray.astype"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.astype</span></code></a></td>
<td>Returns a copy of the array after casting to a specified type.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-change-shape">
<span id="array-change-shape"></span><h3>Array change shape<a class="headerlink" href="#array-change-shape" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.T" title="mxnet.ndarray.NDArray.T"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.T</span></code></a></td>
<td>Returns a copy of the array with axes transposed.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.reshape" title="mxnet.ndarray.NDArray.reshape"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.reshape</span></code></a></td>
<td>Returns a <strong>view</strong> of this array with a new shape without altering any data.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.broadcast_to" title="mxnet.ndarray.NDArray.broadcast_to"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.broadcast_to</span></code></a></td>
<td>Broadcasts the input array to a new shape.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="arithmetic-operations">
<span id="arithmetic-operations"></span><h3>Arithmetic operations<a class="headerlink" href="#arithmetic-operations" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__add__" title="mxnet.ndarray.NDArray.__add__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__add__</span></code></a></td>
<td>x.__add__(y) <=> x+y <=> mx.nd.add(x, y)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__sub__" title="mxnet.ndarray.NDArray.__sub__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__sub__</span></code></a></td>
<td>x.__sub__(y) <=> x-y <=> mx.nd.subtract(x, y)</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__rsub__" title="mxnet.ndarray.NDArray.__rsub__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__rsub__</span></code></a></td>
<td>x.__rsub__(y) <=> y-x <=> mx.nd.subtract(y, x)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__neg__" title="mxnet.ndarray.NDArray.__neg__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__neg__</span></code></a></td>
<td>x.__neg__(y) <=> -x</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__mul__" title="mxnet.ndarray.NDArray.__mul__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__mul__</span></code></a></td>
<td>x.__mul__(y) <=> x*y <=> mx.nd.multiply(x, y)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__div__" title="mxnet.ndarray.NDArray.__div__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__div__</span></code></a></td>
<td>x.__div__(y) <=> x/y <=> mx.nd.divide(x, y)</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__rdiv__" title="mxnet.ndarray.NDArray.__rdiv__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__rdiv__</span></code></a></td>
<td>x.__rdiv__(y) <=> y/x <=> mx.nd.divide(y, x)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__mod__" title="mxnet.ndarray.NDArray.__mod__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__mod__</span></code></a></td>
<td>x.__mod__(y) <=> x%y <=> mx.nd.modulo(x, y)</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__rmod__" title="mxnet.ndarray.NDArray.__rmod__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__rmod__</span></code></a></td>
<td>x.__rmod__(y) <=> y%x <=> mx.nd.modulo(y, x)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__pow__" title="mxnet.ndarray.NDArray.__pow__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__pow__</span></code></a></td>
<td>x.__pow__(y) <=> x**y <=> mx.nd.power(x,y)</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="in-place-arithmetic-operations">
<span id="in-place-arithmetic-operations"></span><h3>In-place arithmetic operations<a class="headerlink" href="#in-place-arithmetic-operations" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__iadd__" title="mxnet.ndarray.NDArray.__iadd__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__iadd__</span></code></a></td>
<td>x.__iadd__(y) <=> x+=y</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__isub__" title="mxnet.ndarray.NDArray.__isub__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__isub__</span></code></a></td>
<td>x.__isub__(y) <=> x-=y</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__imul__" title="mxnet.ndarray.NDArray.__imul__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__imul__</span></code></a></td>
<td>x.__imul__(y) <=> x*=y</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__idiv__" title="mxnet.ndarray.NDArray.__idiv__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__idiv__</span></code></a></td>
<td>x.__rdiv__(y) <=> x/=y</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__imod__" title="mxnet.ndarray.NDArray.__imod__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__imod__</span></code></a></td>
<td>x.__rmod__(y) <=> x%=y</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="comparison-operators">
<span id="comparison-operators"></span><h3>Comparison operators<a class="headerlink" href="#comparison-operators" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__lt__" title="mxnet.ndarray.NDArray.__lt__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__lt__</span></code></a></td>
<td>x.__lt__(y) <=> x<y <=> mx.nd.lesser(x, y)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__le__" title="mxnet.ndarray.NDArray.__le__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__le__</span></code></a></td>
<td>x.__le__(y) <=> x<=y <=> mx.nd.less_equal(x, y)</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__gt__" title="mxnet.ndarray.NDArray.__gt__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__gt__</span></code></a></td>
<td>x.__gt__(y) <=> x>y <=> mx.nd.greater(x, y)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__ge__" title="mxnet.ndarray.NDArray.__ge__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__ge__</span></code></a></td>
<td>x.__ge__(y) <=> x>=y <=> mx.nd.greater_equal(x, y)</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__eq__" title="mxnet.ndarray.NDArray.__eq__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__eq__</span></code></a></td>
<td>x.__eq__(y) <=> x==y <=> mx.nd.equal(x, y)</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__ne__" title="mxnet.ndarray.NDArray.__ne__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__ne__</span></code></a></td>
<td>x.__ne__(y) <=> x!=y <=> mx.nd.not_equal(x, y)</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="indexing">
<span id="indexing"></span><h3>Indexing<a class="headerlink" href="#indexing" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__getitem__" title="mxnet.ndarray.NDArray.__getitem__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__getitem__</span></code></a></td>
<td>x.__getitem__(i) <=> x[i]</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.__setitem__" title="mxnet.ndarray.NDArray.__setitem__"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.__setitem__</span></code></a></td>
<td>x.__setitem__(i, y) <=> x[i]=y</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="lazy-evaluation">
<span id="lazy-evaluation"></span><h3>Lazy evaluation<a class="headerlink" href="#lazy-evaluation" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.NDArray.wait_to_read" title="mxnet.ndarray.NDArray.wait_to_read"><code class="xref py py-obj docutils literal"><span class="pre">NDArray.wait_to_read</span></code></a></td>
<td>Waits until all previous write operations on the current array are finished.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="array-creation-routines">
<span id="array-creation-routines"></span><h2>Array creation routines<a class="headerlink" href="#array-creation-routines" title="Permalink to this headline"></a></h2>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.array" title="mxnet.ndarray.array"><code class="xref py py-obj docutils literal"><span class="pre">array</span></code></a></td>
<td>Creates an array from any object exposing the array interface.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.empty" title="mxnet.ndarray.empty"><code class="xref py py-obj docutils literal"><span class="pre">empty</span></code></a></td>
<td>Returns a new array of given shape and type, without initializing entries.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.zeros" title="mxnet.ndarray.zeros"><code class="xref py py-obj docutils literal"><span class="pre">zeros</span></code></a></td>
<td>Returns a new array filled with all zeros, with the given shape and type.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.ones" title="mxnet.ndarray.ones"><code class="xref py py-obj docutils literal"><span class="pre">ones</span></code></a></td>
<td>Returns a new array filled with all ones, with the given shape and type.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.full" title="mxnet.ndarray.full"><code class="xref py py-obj docutils literal"><span class="pre">full</span></code></a></td>
<td>Returns a new array of given shape and type, filled with the given value <cite>val</cite>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.arange" title="mxnet.ndarray.arange"><code class="xref py py-obj docutils literal"><span class="pre">arange</span></code></a></td>
<td>Returns evenly spaced values within a given interval.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.load" title="mxnet.ndarray.load"><code class="xref py py-obj docutils literal"><span class="pre">load</span></code></a></td>
<td>Loads an array from file.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.save" title="mxnet.ndarray.save"><code class="xref py py-obj docutils literal"><span class="pre">save</span></code></a></td>
<td>Saves a list of arrays or a dict of str->array to file.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-manipulation-routines">
<span id="array-manipulation-routines"></span><h2>Array manipulation routines<a class="headerlink" href="#array-manipulation-routines" title="Permalink to this headline"></a></h2>
<div class="section" id="changing-array-shape-and-type">
<span id="changing-array-shape-and-type"></span><h3>Changing array shape and type<a class="headerlink" href="#changing-array-shape-and-type" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.cast" title="mxnet.ndarray.cast"><code class="xref py py-obj docutils literal"><span class="pre">cast</span></code></a></td>
<td>Casts all elements of the input to a new type.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.reshape" title="mxnet.ndarray.reshape"><code class="xref py py-obj docutils literal"><span class="pre">reshape</span></code></a></td>
<td>Reshapes the input array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.flatten" title="mxnet.ndarray.flatten"><code class="xref py py-obj docutils literal"><span class="pre">flatten</span></code></a></td>
<td>Flattens the input array into a 2-D array by collapsing the higher dimensions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.expand_dims" title="mxnet.ndarray.expand_dims"><code class="xref py py-obj docutils literal"><span class="pre">expand_dims</span></code></a></td>
<td>Inserts a new axis of size 1 into the array shape</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="expanding-array-elements">
<span id="expanding-array-elements"></span><h3>Expanding array elements<a class="headerlink" href="#expanding-array-elements" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.broadcast_to" title="mxnet.ndarray.broadcast_to"><code class="xref py py-obj docutils literal"><span class="pre">broadcast_to</span></code></a></td>
<td>Broadcasts the input array to a new shape.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.broadcast_axes" title="mxnet.ndarray.broadcast_axes"><code class="xref py py-obj docutils literal"><span class="pre">broadcast_axes</span></code></a></td>
<td>Broadcasts the input array over particular axes.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.repeat" title="mxnet.ndarray.repeat"><code class="xref py py-obj docutils literal"><span class="pre">repeat</span></code></a></td>
<td>Repeats elements of an array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.tile" title="mxnet.ndarray.tile"><code class="xref py py-obj docutils literal"><span class="pre">tile</span></code></a></td>
<td>Repeats the whole array multiple times.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.pad" title="mxnet.ndarray.pad"><code class="xref py py-obj docutils literal"><span class="pre">pad</span></code></a></td>
<td>Pads an input array with a constant or edge values of the array.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="rearranging-elements">
<span id="rearranging-elements"></span><h3>Rearranging elements<a class="headerlink" href="#rearranging-elements" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.transpose" title="mxnet.ndarray.transpose"><code class="xref py py-obj docutils literal"><span class="pre">transpose</span></code></a></td>
<td>Permutes the dimensions of an array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.swapaxes" title="mxnet.ndarray.swapaxes"><code class="xref py py-obj docutils literal"><span class="pre">swapaxes</span></code></a></td>
<td>Interchanges two axes of an array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.flip" title="mxnet.ndarray.flip"><code class="xref py py-obj docutils literal"><span class="pre">flip</span></code></a></td>
<td>Reverses the order of elements along given axis while preserving array shape.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="joining-and-splitting-arrays">
<span id="joining-and-splitting-arrays"></span><h3>Joining and splitting arrays<a class="headerlink" href="#joining-and-splitting-arrays" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.concat" title="mxnet.ndarray.concat"><code class="xref py py-obj docutils literal"><span class="pre">concat</span></code></a></td>
<td>Joins input arrays along a given axis.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.split" title="mxnet.ndarray.split"><code class="xref py py-obj docutils literal"><span class="pre">split</span></code></a></td>
<td>Splits an array along a particular axis into multiple sub-arrays.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="indexing-routines">
<span id="indexing-routines"></span><h3>Indexing routines<a class="headerlink" href="#indexing-routines" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.slice" title="mxnet.ndarray.slice"><code class="xref py py-obj docutils literal"><span class="pre">slice</span></code></a></td>
<td>Slices a contiguous region of the array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.slice_axis" title="mxnet.ndarray.slice_axis"><code class="xref py py-obj docutils literal"><span class="pre">slice_axis</span></code></a></td>
<td>Slices along a given axis.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.take" title="mxnet.ndarray.take"><code class="xref py py-obj docutils literal"><span class="pre">take</span></code></a></td>
<td>Takes elements from an input array along the given axis.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.batch_take" title="mxnet.ndarray.batch_take"><code class="xref py py-obj docutils literal"><span class="pre">batch_take</span></code></a></td>
<td>Takes elements from a data batch.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.one_hot" title="mxnet.ndarray.one_hot"><code class="xref py py-obj docutils literal"><span class="pre">one_hot</span></code></a></td>
<td>Returns a one-hot array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.pick" title="mxnet.ndarray.pick"><code class="xref py py-obj docutils literal"><span class="pre">pick</span></code></a></td>
<td>Picks elements from an input array according to the input indices along the given axis.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="mathematical-functions">
<span id="mathematical-functions"></span><h2>Mathematical functions<a class="headerlink" href="#mathematical-functions" title="Permalink to this headline"></a></h2>
<div class="section" id="arithmetic-operations">
<span id="id1"></span><h3>Arithmetic operations<a class="headerlink" href="#arithmetic-operations" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.add" title="mxnet.ndarray.add"><code class="xref py py-obj docutils literal"><span class="pre">add</span></code></a></td>
<td>Returns element-wise sum of the input arrays with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.subtract" title="mxnet.ndarray.subtract"><code class="xref py py-obj docutils literal"><span class="pre">subtract</span></code></a></td>
<td>Returns element-wise difference of the input arrays with broadcasting.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.negative" title="mxnet.ndarray.negative"><code class="xref py py-obj docutils literal"><span class="pre">negative</span></code></a></td>
<td>Negate src</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.multiply" title="mxnet.ndarray.multiply"><code class="xref py py-obj docutils literal"><span class="pre">multiply</span></code></a></td>
<td>Returns element-wise product of the input arrays with broadcasting.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.divide" title="mxnet.ndarray.divide"><code class="xref py py-obj docutils literal"><span class="pre">divide</span></code></a></td>
<td>Returns element-wise division of the input arrays with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.modulo" title="mxnet.ndarray.modulo"><code class="xref py py-obj docutils literal"><span class="pre">modulo</span></code></a></td>
<td>Returns element-wise modulo of the input arrays with broadcasting.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.dot" title="mxnet.ndarray.dot"><code class="xref py py-obj docutils literal"><span class="pre">dot</span></code></a></td>
<td>Dot product of two arrays.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.batch_dot" title="mxnet.ndarray.batch_dot"><code class="xref py py-obj docutils literal"><span class="pre">batch_dot</span></code></a></td>
<td>Batchwise dot product.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.add_n" title="mxnet.ndarray.add_n"><code class="xref py py-obj docutils literal"><span class="pre">add_n</span></code></a></td>
<td>Adds all input arguments element-wise.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="trigonometric-functions">
<span id="trigonometric-functions"></span><h3>Trigonometric functions<a class="headerlink" href="#trigonometric-functions" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sin" title="mxnet.ndarray.sin"><code class="xref py py-obj docutils literal"><span class="pre">sin</span></code></a></td>
<td>Computes the element-wise sine of the input array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.cos" title="mxnet.ndarray.cos"><code class="xref py py-obj docutils literal"><span class="pre">cos</span></code></a></td>
<td>Computes the element-wise cosine of the input array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.tan" title="mxnet.ndarray.tan"><code class="xref py py-obj docutils literal"><span class="pre">tan</span></code></a></td>
<td>Computes the element-wise tangent of the input array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.arcsin" title="mxnet.ndarray.arcsin"><code class="xref py py-obj docutils literal"><span class="pre">arcsin</span></code></a></td>
<td>Returns element-wise inverse sine of the input array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.arccos" title="mxnet.ndarray.arccos"><code class="xref py py-obj docutils literal"><span class="pre">arccos</span></code></a></td>
<td>Returns element-wise inverse cosine of the input array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.arctan" title="mxnet.ndarray.arctan"><code class="xref py py-obj docutils literal"><span class="pre">arctan</span></code></a></td>
<td>Returns element-wise inverse tangent of the input array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.degrees" title="mxnet.ndarray.degrees"><code class="xref py py-obj docutils literal"><span class="pre">degrees</span></code></a></td>
<td>Converts each element of the input array from radians to degrees.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.radians" title="mxnet.ndarray.radians"><code class="xref py py-obj docutils literal"><span class="pre">radians</span></code></a></td>
<td>Converts each element of the input array from degrees to radians.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="hyperbolic-functions">
<span id="hyperbolic-functions"></span><h3>Hyperbolic functions<a class="headerlink" href="#hyperbolic-functions" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sinh" title="mxnet.ndarray.sinh"><code class="xref py py-obj docutils literal"><span class="pre">sinh</span></code></a></td>
<td>Returns the hyperbolic sine of the input array, computed element-wise.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.cosh" title="mxnet.ndarray.cosh"><code class="xref py py-obj docutils literal"><span class="pre">cosh</span></code></a></td>
<td>Returns the hyperbolic cosine of the input array, computed element-wise.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.tanh" title="mxnet.ndarray.tanh"><code class="xref py py-obj docutils literal"><span class="pre">tanh</span></code></a></td>
<td>Returns the hyperbolic tangent of the input array, computed element-wise.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.arcsinh" title="mxnet.ndarray.arcsinh"><code class="xref py py-obj docutils literal"><span class="pre">arcsinh</span></code></a></td>
<td>Returns the element-wise inverse hyperbolic sine of the input array, computed element-wise.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.arccosh" title="mxnet.ndarray.arccosh"><code class="xref py py-obj docutils literal"><span class="pre">arccosh</span></code></a></td>
<td>Returns the element-wise inverse hyperbolic cosine of the input array, computed element-wise.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.arctanh" title="mxnet.ndarray.arctanh"><code class="xref py py-obj docutils literal"><span class="pre">arctanh</span></code></a></td>
<td>Returns the element-wise inverse hyperbolic tangent of the input array, computed element-wise.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="reduce-functions">
<span id="reduce-functions"></span><h3>Reduce functions<a class="headerlink" href="#reduce-functions" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sum" title="mxnet.ndarray.sum"><code class="xref py py-obj docutils literal"><span class="pre">sum</span></code></a></td>
<td>Computes the sum of array elements over given axes.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.nansum" title="mxnet.ndarray.nansum"><code class="xref py py-obj docutils literal"><span class="pre">nansum</span></code></a></td>
<td>Computes the sum of array elements over given axes treating Not a Numbers (<code class="docutils literal"><span class="pre">NaN</span></code>) as zero.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.prod" title="mxnet.ndarray.prod"><code class="xref py py-obj docutils literal"><span class="pre">prod</span></code></a></td>
<td>Computes the product of array elements over given axes.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.nanprod" title="mxnet.ndarray.nanprod"><code class="xref py py-obj docutils literal"><span class="pre">nanprod</span></code></a></td>
<td>Computes the product of array elements over given axes treating Not a Numbers (<code class="docutils literal"><span class="pre">NaN</span></code>) as one.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.mean" title="mxnet.ndarray.mean"><code class="xref py py-obj docutils literal"><span class="pre">mean</span></code></a></td>
<td>Computes the mean of array elements over given axes.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.max" title="mxnet.ndarray.max"><code class="xref py py-obj docutils literal"><span class="pre">max</span></code></a></td>
<td>Computes the max of array elements over given axes.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.min" title="mxnet.ndarray.min"><code class="xref py py-obj docutils literal"><span class="pre">min</span></code></a></td>
<td>Computes the min of array elements over given axes.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.norm" title="mxnet.ndarray.norm"><code class="xref py py-obj docutils literal"><span class="pre">norm</span></code></a></td>
<td>Flattens the input array and then computes the l2 norm.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="rounding">
<span id="rounding"></span><h3>Rounding<a class="headerlink" href="#rounding" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.round" title="mxnet.ndarray.round"><code class="xref py py-obj docutils literal"><span class="pre">round</span></code></a></td>
<td>Returns element-wise rounded value to the nearest integer of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.rint" title="mxnet.ndarray.rint"><code class="xref py py-obj docutils literal"><span class="pre">rint</span></code></a></td>
<td>Returns element-wise rounded value to the nearest integer of the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.fix" title="mxnet.ndarray.fix"><code class="xref py py-obj docutils literal"><span class="pre">fix</span></code></a></td>
<td>Returns element-wise rounded value to the nearest integer towards zero of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.floor" title="mxnet.ndarray.floor"><code class="xref py py-obj docutils literal"><span class="pre">floor</span></code></a></td>
<td>Returns element-wise floor of the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.ceil" title="mxnet.ndarray.ceil"><code class="xref py py-obj docutils literal"><span class="pre">ceil</span></code></a></td>
<td>Returns element-wise ceiling of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.trunc" title="mxnet.ndarray.trunc"><code class="xref py py-obj docutils literal"><span class="pre">trunc</span></code></a></td>
<td>Return the element-wise truncated value of the input.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="exponents-and-logarithms">
<span id="exponents-and-logarithms"></span><h3>Exponents and logarithms<a class="headerlink" href="#exponents-and-logarithms" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.exp" title="mxnet.ndarray.exp"><code class="xref py py-obj docutils literal"><span class="pre">exp</span></code></a></td>
<td>Returns element-wise exponential value of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.expm1" title="mxnet.ndarray.expm1"><code class="xref py py-obj docutils literal"><span class="pre">expm1</span></code></a></td>
<td>Returns <code class="docutils literal"><span class="pre">exp(x)</span> <span class="pre">-</span> <span class="pre">1</span></code> computed element-wise on the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.log" title="mxnet.ndarray.log"><code class="xref py py-obj docutils literal"><span class="pre">log</span></code></a></td>
<td>Returns element-wise Natural logarithmic value of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.log10" title="mxnet.ndarray.log10"><code class="xref py py-obj docutils literal"><span class="pre">log10</span></code></a></td>
<td>Returns element-wise Base-10 logarithmic value of the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.log2" title="mxnet.ndarray.log2"><code class="xref py py-obj docutils literal"><span class="pre">log2</span></code></a></td>
<td>Returns element-wise Base-2 logarithmic value of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.log1p" title="mxnet.ndarray.log1p"><code class="xref py py-obj docutils literal"><span class="pre">log1p</span></code></a></td>
<td>Returns element-wise <code class="docutils literal"><span class="pre">log(1</span> <span class="pre">+</span> <span class="pre">x)</span></code> value of the input.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="powers">
<span id="powers"></span><h3>Powers<a class="headerlink" href="#powers" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.power" title="mxnet.ndarray.power"><code class="xref py py-obj docutils literal"><span class="pre">power</span></code></a></td>
<td>Returns result of first array elements raised to powers from second array, element-wise with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sqrt" title="mxnet.ndarray.sqrt"><code class="xref py py-obj docutils literal"><span class="pre">sqrt</span></code></a></td>
<td>Returns element-wise square-root value of the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.rsqrt" title="mxnet.ndarray.rsqrt"><code class="xref py py-obj docutils literal"><span class="pre">rsqrt</span></code></a></td>
<td>Returns element-wise inverse square-root value of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.square" title="mxnet.ndarray.square"><code class="xref py py-obj docutils literal"><span class="pre">square</span></code></a></td>
<td>Returns element-wise squared value of the input.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="logic-functions">
<span id="logic-functions"></span><h3>Logic functions<a class="headerlink" href="#logic-functions" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.equal" title="mxnet.ndarray.equal"><code class="xref py py-obj docutils literal"><span class="pre">equal</span></code></a></td>
<td>Returns the result of element-wise <strong>equal to</strong> (==) comparison operation with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.not_equal" title="mxnet.ndarray.not_equal"><code class="xref py py-obj docutils literal"><span class="pre">not_equal</span></code></a></td>
<td>Returns the result of element-wise <strong>not equal to</strong> (!=) comparison operation with broadcasting.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.greater" title="mxnet.ndarray.greater"><code class="xref py py-obj docutils literal"><span class="pre">greater</span></code></a></td>
<td>Returns the result of element-wise <strong>greater than</strong> (>) comparison operation with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.greater_equal" title="mxnet.ndarray.greater_equal"><code class="xref py py-obj docutils literal"><span class="pre">greater_equal</span></code></a></td>
<td>Returns the result of element-wise <strong>greater than or equal to</strong> (>=) comparison operation with broadcasting.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.lesser" title="mxnet.ndarray.lesser"><code class="xref py py-obj docutils literal"><span class="pre">lesser</span></code></a></td>
<td>Returns the result of element-wise <strong>lesser than</strong> (<) comparison operation with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.lesser_equal" title="mxnet.ndarray.lesser_equal"><code class="xref py py-obj docutils literal"><span class="pre">lesser_equal</span></code></a></td>
<td>Returns the result of element-wise <strong>lesser than or equal to</strong> (<=) comparison operation with broadcasting.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="random-sampling">
<span id="random-sampling"></span><h3>Random sampling<a class="headerlink" href="#random-sampling" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.random_uniform" title="mxnet.ndarray.random_uniform"><code class="xref py py-obj docutils literal"><span class="pre">random_uniform</span></code></a></td>
<td>Draw random samples from a uniform distribution.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.random_normal" title="mxnet.ndarray.random_normal"><code class="xref py py-obj docutils literal"><span class="pre">random_normal</span></code></a></td>
<td>Draw random samples from a normal (Gaussian) distribution.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.random_gamma" title="mxnet.ndarray.random_gamma"><code class="xref py py-obj docutils literal"><span class="pre">random_gamma</span></code></a></td>
<td>Draw random samples from a gamma distribution.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.random_exponential" title="mxnet.ndarray.random_exponential"><code class="xref py py-obj docutils literal"><span class="pre">random_exponential</span></code></a></td>
<td>Draw random samples from an exponential distribution.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.random_poisson" title="mxnet.ndarray.random_poisson"><code class="xref py py-obj docutils literal"><span class="pre">random_poisson</span></code></a></td>
<td>Draw random samples from a Poisson distribution.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.random_negative_binomial" title="mxnet.ndarray.random_negative_binomial"><code class="xref py py-obj docutils literal"><span class="pre">random_negative_binomial</span></code></a></td>
<td>Draw random samples from a negative binomial distribution.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.random_generalized_negative_binomial" title="mxnet.ndarray.random_generalized_negative_binomial"><code class="xref py py-obj docutils literal"><span class="pre">random_generalized_negative_binomial</span></code></a></td>
<td>Draw random samples from a generalized negative binomial distribution.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.random.seed" title="mxnet.random.seed"><code class="xref py py-obj docutils literal"><span class="pre">mxnet.random.seed</span></code></a></td>
<td>Seeds the random number generators in MXNet.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="sorting-and-searching">
<span id="sorting-and-searching"></span><h3>Sorting and searching<a class="headerlink" href="#sorting-and-searching" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sort" title="mxnet.ndarray.sort"><code class="xref py py-obj docutils literal"><span class="pre">sort</span></code></a></td>
<td>Returns a sorted copy of an input array along the given axis.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.topk" title="mxnet.ndarray.topk"><code class="xref py py-obj docutils literal"><span class="pre">topk</span></code></a></td>
<td>Returns the top <em>k</em> elements in an input array along the given axis.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.argsort" title="mxnet.ndarray.argsort"><code class="xref py py-obj docutils literal"><span class="pre">argsort</span></code></a></td>
<td>Returns the indices that would sort an input array along the given axis.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.argmax" title="mxnet.ndarray.argmax"><code class="xref py py-obj docutils literal"><span class="pre">argmax</span></code></a></td>
<td>Returns indices of the maximum values along an axis.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.argmin" title="mxnet.ndarray.argmin"><code class="xref py py-obj docutils literal"><span class="pre">argmin</span></code></a></td>
<td>Returns indices of the minimum values along an axis.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="miscellaneous">
<span id="miscellaneous"></span><h3>Miscellaneous<a class="headerlink" href="#miscellaneous" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.maximum" title="mxnet.ndarray.maximum"><code class="xref py py-obj docutils literal"><span class="pre">maximum</span></code></a></td>
<td>Returns element-wise maximum of the input arrays with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.minimum" title="mxnet.ndarray.minimum"><code class="xref py py-obj docutils literal"><span class="pre">minimum</span></code></a></td>
<td>Returns element-wise minimum of the input arrays with broadcasting.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.clip" title="mxnet.ndarray.clip"><code class="xref py py-obj docutils literal"><span class="pre">clip</span></code></a></td>
<td>Clips (limits) the values in an array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.abs" title="mxnet.ndarray.abs"><code class="xref py py-obj docutils literal"><span class="pre">abs</span></code></a></td>
<td>Returns element-wise absolute value of the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sign" title="mxnet.ndarray.sign"><code class="xref py py-obj docutils literal"><span class="pre">sign</span></code></a></td>
<td>Returns element-wise sign of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.gamma" title="mxnet.ndarray.gamma"><code class="xref py py-obj docutils literal"><span class="pre">gamma</span></code></a></td>
<td>Returns the gamma function (extension of the factorial function to the reals) , computed element-wise on the input array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.gammaln" title="mxnet.ndarray.gammaln"><code class="xref py py-obj docutils literal"><span class="pre">gammaln</span></code></a></td>
<td>Returns element-wise log of the absolute value of the gamma function of the input.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="neural-network">
<span id="neural-network"></span><h2>Neural network<a class="headerlink" href="#neural-network" title="Permalink to this headline"></a></h2>
<div class="section" id="basic">
<span id="basic"></span><h3>Basic<a class="headerlink" href="#basic" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.FullyConnected" title="mxnet.ndarray.FullyConnected"><code class="xref py py-obj docutils literal"><span class="pre">FullyConnected</span></code></a></td>
<td>Applies a linear transformation: <span class="math">\(Y = XW^T + b\)</span>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.Convolution" title="mxnet.ndarray.Convolution"><code class="xref py py-obj docutils literal"><span class="pre">Convolution</span></code></a></td>
<td>Compute <em>N</em>-D convolution on <em>(N+2)</em>-D input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.Activation" title="mxnet.ndarray.Activation"><code class="xref py py-obj docutils literal"><span class="pre">Activation</span></code></a></td>
<td>Applies an activation function element-wise to the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.BatchNorm" title="mxnet.ndarray.BatchNorm"><code class="xref py py-obj docutils literal"><span class="pre">BatchNorm</span></code></a></td>
<td>Batch normalization.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.Pooling" title="mxnet.ndarray.Pooling"><code class="xref py py-obj docutils literal"><span class="pre">Pooling</span></code></a></td>
<td>Performs pooling on the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.SoftmaxOutput" title="mxnet.ndarray.SoftmaxOutput"><code class="xref py py-obj docutils literal"><span class="pre">SoftmaxOutput</span></code></a></td>
<td>Computes the gradient of cross entropy loss with respect to softmax output.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.softmax" title="mxnet.ndarray.softmax"><code class="xref py py-obj docutils literal"><span class="pre">softmax</span></code></a></td>
<td>Applies the softmax function.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.log_softmax" title="mxnet.ndarray.log_softmax"><code class="xref py py-obj docutils literal"><span class="pre">log_softmax</span></code></a></td>
<td>Computes the log softmax of the input.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="more">
<span id="more"></span><h3>More<a class="headerlink" href="#more" title="Permalink to this headline"></a></h3>
<table border="1" class="longtable docutils">
<colgroup>
<col width="10%"/>
<col width="90%"/>
</colgroup>
<tbody valign="top">
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.Correlation" title="mxnet.ndarray.Correlation"><code class="xref py py-obj docutils literal"><span class="pre">Correlation</span></code></a></td>
<td>Applies correlation to inputs.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.Deconvolution" title="mxnet.ndarray.Deconvolution"><code class="xref py py-obj docutils literal"><span class="pre">Deconvolution</span></code></a></td>
<td>Computes 2D transposed convolution (aka fractionally strided convolution) of the input tensor.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.RNN" title="mxnet.ndarray.RNN"><code class="xref py py-obj docutils literal"><span class="pre">RNN</span></code></a></td>
<td>Applies a recurrent layer to input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.Embedding" title="mxnet.ndarray.Embedding"><code class="xref py py-obj docutils literal"><span class="pre">Embedding</span></code></a></td>
<td>Maps integer indices to vector representations (embeddings).</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.LeakyReLU" title="mxnet.ndarray.LeakyReLU"><code class="xref py py-obj docutils literal"><span class="pre">LeakyReLU</span></code></a></td>
<td>Applies Leaky rectified linear unit activation element-wise to the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.InstanceNorm" title="mxnet.ndarray.InstanceNorm"><code class="xref py py-obj docutils literal"><span class="pre">InstanceNorm</span></code></a></td>
<td>Applies instance normalization to the n-dimensional input array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.L2Normalization" title="mxnet.ndarray.L2Normalization"><code class="xref py py-obj docutils literal"><span class="pre">L2Normalization</span></code></a></td>
<td>Normalize the input array using the L2 norm.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.LRN" title="mxnet.ndarray.LRN"><code class="xref py py-obj docutils literal"><span class="pre">LRN</span></code></a></td>
<td>Applies local response normalization to the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.ROIPooling" title="mxnet.ndarray.ROIPooling"><code class="xref py py-obj docutils literal"><span class="pre">ROIPooling</span></code></a></td>
<td>Performs region of interest(ROI) pooling on the input array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.SoftmaxActivation" title="mxnet.ndarray.SoftmaxActivation"><code class="xref py py-obj docutils literal"><span class="pre">SoftmaxActivation</span></code></a></td>
<td>Applies softmax activation to input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.Dropout" title="mxnet.ndarray.Dropout"><code class="xref py py-obj docutils literal"><span class="pre">Dropout</span></code></a></td>
<td>Applies dropout operation to input array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.BilinearSampler" title="mxnet.ndarray.BilinearSampler"><code class="xref py py-obj docutils literal"><span class="pre">BilinearSampler</span></code></a></td>
<td>Applies bilinear sampling to input feature map, which is the key of “[NIPS2015] Spatial Transformer Networks” output[batch, channel, y_dst, x_dst] = G(data[batch, channel, y_src, x_src) x_dst, y_dst enumerate all spatial locations in output x_src = grid[batch, 0, y_dst, x_dst] y_src = grid[batch, 1, y_dst, x_dst] G() denotes the bilinear interpolation kernel The out-boundary points will be padded as zeros.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.GridGenerator" title="mxnet.ndarray.GridGenerator"><code class="xref py py-obj docutils literal"><span class="pre">GridGenerator</span></code></a></td>
<td>Generates 2D sampling grid for bilinear sampling.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.UpSampling" title="mxnet.ndarray.UpSampling"><code class="xref py py-obj docutils literal"><span class="pre">UpSampling</span></code></a></td>
<td>Performs nearest neighbor/bilinear up sampling to inputs.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.SpatialTransformer" title="mxnet.ndarray.SpatialTransformer"><code class="xref py py-obj docutils literal"><span class="pre">SpatialTransformer</span></code></a></td>
<td>Applies a spatial transformer to input feature map.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.LinearRegressionOutput" title="mxnet.ndarray.LinearRegressionOutput"><code class="xref py py-obj docutils literal"><span class="pre">LinearRegressionOutput</span></code></a></td>
<td>Computes and optimizes for squared loss during backward propagation.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.LogisticRegressionOutput" title="mxnet.ndarray.LogisticRegressionOutput"><code class="xref py py-obj docutils literal"><span class="pre">LogisticRegressionOutput</span></code></a></td>
<td>Applies a logistic function to the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.MAERegressionOutput" title="mxnet.ndarray.MAERegressionOutput"><code class="xref py py-obj docutils literal"><span class="pre">MAERegressionOutput</span></code></a></td>
<td>Computes mean absolute error of the input.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.SVMOutput" title="mxnet.ndarray.SVMOutput"><code class="xref py py-obj docutils literal"><span class="pre">SVMOutput</span></code></a></td>
<td>Computes support vector machine based transformation of the input.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.softmax_cross_entropy" title="mxnet.ndarray.softmax_cross_entropy"><code class="xref py py-obj docutils literal"><span class="pre">softmax_cross_entropy</span></code></a></td>
<td>Calculate cross entropy of softmax output and one-hot label.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.smooth_l1" title="mxnet.ndarray.smooth_l1"><code class="xref py py-obj docutils literal"><span class="pre">smooth_l1</span></code></a></td>
<td>Calculate Smooth L1 Loss(lhs, scalar) by summing</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.IdentityAttachKLSparseReg" title="mxnet.ndarray.IdentityAttachKLSparseReg"><code class="xref py py-obj docutils literal"><span class="pre">IdentityAttachKLSparseReg</span></code></a></td>
<td>Apply a sparse regularization to the output a sigmoid activation function.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.MakeLoss" title="mxnet.ndarray.MakeLoss"><code class="xref py py-obj docutils literal"><span class="pre">MakeLoss</span></code></a></td>
<td>Make your own loss function in network construction.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.BlockGrad" title="mxnet.ndarray.BlockGrad"><code class="xref py py-obj docutils literal"><span class="pre">BlockGrad</span></code></a></td>
<td>Stops gradient computation.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.Custom" title="mxnet.ndarray.Custom"><code class="xref py py-obj docutils literal"><span class="pre">Custom</span></code></a></td>
<td>Apply a custom operator implemented in a frontend language (like Python).</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="api-reference">
<span id="api-reference"></span><h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline"></a></h2>
<script src="../../_static/js/auto_module_index.js" type="text/javascript"></script><span class="target" id="module-mxnet.ndarray"></span><p>NDArray API of MXNet.</p>
<dl class="function">
<dt id="mxnet.ndarray.waitall">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">waitall</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.waitall" title="Permalink to this definition"></a></dt>
<dd><p>Wait for all async operations to finish in MXNet.</p>
<p>This function is used for benchmarking only.</p>
</dd></dl>
<dl class="class">
<dt id="mxnet.ndarray.NDArray">
<em class="property">class </em><code class="descclassname">mxnet.ndarray.</code><code class="descname">NDArray</code><span class="sig-paren">(</span><em>handle</em>, <em>writable=True</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray" title="Permalink to this definition"></a></dt>
<dd><p>An array object representing a multidimensional, homogeneous array of
fixed-size items.</p>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__repr__">
<code class="descname">__repr__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__repr__" title="Permalink to this definition"></a></dt>
<dd><p>Returns a string representation of the array.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__add__">
<code class="descname">__add__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__add__" title="Permalink to this definition"></a></dt>
<dd><p>x.__add__(y) <=> x+y <=> mx.nd.add(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__iadd__">
<code class="descname">__iadd__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__iadd__" title="Permalink to this definition"></a></dt>
<dd><p>x.__iadd__(y) <=> x+=y</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__sub__">
<code class="descname">__sub__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__sub__" title="Permalink to this definition"></a></dt>
<dd><p>x.__sub__(y) <=> x-y <=> mx.nd.subtract(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__isub__">
<code class="descname">__isub__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__isub__" title="Permalink to this definition"></a></dt>
<dd><p>x.__isub__(y) <=> x-=y</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__rsub__">
<code class="descname">__rsub__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__rsub__" title="Permalink to this definition"></a></dt>
<dd><p>x.__rsub__(y) <=> y-x <=> mx.nd.subtract(y, x)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__mul__">
<code class="descname">__mul__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__mul__" title="Permalink to this definition"></a></dt>
<dd><p>x.__mul__(y) <=> x*y <=> mx.nd.multiply(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__neg__">
<code class="descname">__neg__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__neg__" title="Permalink to this definition"></a></dt>
<dd><p>x.__neg__(y) <=> -x</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__imul__">
<code class="descname">__imul__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__imul__" title="Permalink to this definition"></a></dt>
<dd><p>x.__imul__(y) <=> x*=y</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__div__">
<code class="descname">__div__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__div__" title="Permalink to this definition"></a></dt>
<dd><p>x.__div__(y) <=> x/y <=> mx.nd.divide(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__rdiv__">
<code class="descname">__rdiv__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__rdiv__" title="Permalink to this definition"></a></dt>
<dd><p>x.__rdiv__(y) <=> y/x <=> mx.nd.divide(y, x)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__idiv__">
<code class="descname">__idiv__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__idiv__" title="Permalink to this definition"></a></dt>
<dd><p>x.__rdiv__(y) <=> x/=y</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__mod__">
<code class="descname">__mod__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__mod__" title="Permalink to this definition"></a></dt>
<dd><p>x.__mod__(y) <=> x%y <=> mx.nd.modulo(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__rmod__">
<code class="descname">__rmod__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__rmod__" title="Permalink to this definition"></a></dt>
<dd><p>x.__rmod__(y) <=> y%x <=> mx.nd.modulo(y, x)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__imod__">
<code class="descname">__imod__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__imod__" title="Permalink to this definition"></a></dt>
<dd><p>x.__rmod__(y) <=> x%=y</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__pow__">
<code class="descname">__pow__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__pow__" title="Permalink to this definition"></a></dt>
<dd><p>x.__pow__(y) <=> x**y <=> mx.nd.power(x,y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__rpow__">
<code class="descname">__rpow__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__rpow__" title="Permalink to this definition"></a></dt>
<dd><p>x.__pow__(y) <=> y**x <=> mx.nd.power(y,x)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__eq__">
<code class="descname">__eq__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__eq__" title="Permalink to this definition"></a></dt>
<dd><p>x.__eq__(y) <=> x==y <=> mx.nd.equal(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__ne__">
<code class="descname">__ne__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__ne__" title="Permalink to this definition"></a></dt>
<dd><p>x.__ne__(y) <=> x!=y <=> mx.nd.not_equal(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__gt__">
<code class="descname">__gt__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__gt__" title="Permalink to this definition"></a></dt>
<dd><p>x.__gt__(y) <=> x>y <=> mx.nd.greater(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__ge__">
<code class="descname">__ge__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__ge__" title="Permalink to this definition"></a></dt>
<dd><p>x.__ge__(y) <=> x>=y <=> mx.nd.greater_equal(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__lt__">
<code class="descname">__lt__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__lt__" title="Permalink to this definition"></a></dt>
<dd><p>x.__lt__(y) <=> x<y <=> mx.nd.lesser(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__le__">
<code class="descname">__le__</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__le__" title="Permalink to this definition"></a></dt>
<dd><p>x.__le__(y) <=> x<=y <=> mx.nd.less_equal(x, y)</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__setitem__">
<code class="descname">__setitem__</code><span class="sig-paren">(</span><em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__setitem__" title="Permalink to this definition"></a></dt>
<dd><p>x.__setitem__(i, y) <=> x[i]=y</p>
<p>Set self[key] to 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"><ul class="first last simple">
<li><strong>key</strong> (<em>int, slice or tuple</em>) – The indexing key.</li>
<li><strong>value</strong> (<em>scalar, NDArray or numpy.ndarray</em>) – The value to set.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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="gp">>>> </span><span class="n">x</span><span class="p">[:]</span> <span class="o">=</span> <span class="mi">1</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="p">[:,</span><span class="mi">1</span><span class="p">:</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="mi">2</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 2., 1.],</span>
<span class="go"> [ 1., 2., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">:]</span> <span class="o">=</span> <span class="mi">3</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 2., 1.],</span>
<span class="go"> [ 1., 3., 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">:,</span><span class="mi">0</span><span class="p">:</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 2., 1.],</span>
<span class="go"> [ 0., 0., 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="mi">4</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 2., 1.],</span>
<span class="go"> [ 0., 0., 4.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.__getitem__">
<code class="descname">__getitem__</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.__getitem__" title="Permalink to this definition"></a></dt>
<dd><p>x.__getitem__(i) <=> x[i]</p>
<p>Returns a sliced view of this 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>key</strong> (<em>int or slice</em>) – Indexing key.</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</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="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1., 2.],</span>
<span class="go"> [ 3., 4., 5.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 3., 4., 5.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</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="gp">>>> </span><span class="n">y</span><span class="p">[:]</span> <span class="o">=</span> <span class="mi">2</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 3., 4., 5.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.reshape">
<code class="descname">reshape</code><span class="sig-paren">(</span><em>shape</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.reshape" title="Permalink to this definition"></a></dt>
<dd><p>Returns a <strong>view</strong> of this array with a new shape without altering any data.</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>tuple of int</em>) – <p>The new shape should not change the array size, namely
<code class="docutils literal"><span class="pre">np.prod(new_shape)</span></code> should be equal to <code class="docutils literal"><span class="pre">np.prod(self.shape)</span></code>.</p>
<p>One dimension can be -1. In this case, the value is inferred
from the length of the array and remaining dimensions.</p>
<p>0 Dimensions in shape will be copied from original shape, i.e.
if x.shape == (3, 4, 5), x.reshape((0, 20)).shape will be (3, 20).</p>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">An array with desired shape that shares data with this array.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</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="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1., 2.],</span>
<span class="go"> [ 3., 4., 5.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.],</span>
<span class="go"> [ 2., 3.],</span>
<span class="go"> [ 4., 5.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">3</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.],</span>
<span class="go"> [ 2., 3.],</span>
<span class="go"> [ 4., 5.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="p">[:]</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[-1., -1., -1.],</span>
<span class="go"> [-1., -1., -1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.broadcast_to">
<code class="descname">broadcast_to</code><span class="sig-paren">(</span><em>shape</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.broadcast_to" title="Permalink to this definition"></a></dt>
<dd><p>Broadcasts the input array to a new shape.</p>
<p>Broadcasting is only allowed on axes with size 1. The new shape cannot change
the number of dimensions.
For example, you could broadcast from shape (2, 1) to (2, 3), but not from
shape (2, 3) to (2, 3, 3).</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>tuple of int</em>) – The shape of the desired array.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A NDArray with the desired shape that is not sharing data with this
array, even if the new shape is the same as <code class="docutils literal"><span class="pre">self.shape</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</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="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[[ 0.],</span>
<span class="go"> [ 1.],</span>
<span class="go"> [ 2.]]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">broadcast_to</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="mi">3</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.],</span>
<span class="go"> [ 2., 2., 2.]],</span>
<span class="go"> [[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.],</span>
<span class="go"> [ 2., 2., 2.]]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.wait_to_read">
<code class="descname">wait_to_read</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.wait_to_read" title="Permalink to this definition"></a></dt>
<dd><p>Waits until all previous write operations on the current array are finished.</p>
<p>This method guarantees that all previous write operations that pushed
into the backend engine for execution are actually finished.</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">time</span>
<span class="gp">>>> </span><span class="n">tic</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">1000</span><span class="p">,</span><span class="mi">1000</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">b</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">a</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="n">tic</span><span class="p">)</span>
<span class="go">0.003854036331176758</span>
<span class="gp">>>> </span><span class="n">b</span><span class="o">.</span><span class="n">wait_to_read</span><span class="p">()</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">-</span> <span class="n">tic</span><span class="p">)</span>
<span class="go">0.0893700122833252</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.NDArray.ndim">
<code class="descname">ndim</code><a class="headerlink" href="#mxnet.ndarray.NDArray.ndim" title="Permalink to this definition"></a></dt>
<dd><p>Returns the number of dimensions of this array</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">ndim</span>
<span class="go">1</span>
<span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]])</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">ndim</span>
<span class="go">2</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.NDArray.shape">
<code class="descname">shape</code><a class="headerlink" href="#mxnet.ndarray.NDArray.shape" title="Permalink to this definition"></a></dt>
<dd><p>Tuple of array dimensions.</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(4L,)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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="mi">4</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(2L, 3L, 4L)</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.NDArray.size">
<code class="descname">size</code><a class="headerlink" href="#mxnet.ndarray.NDArray.size" title="Permalink to this definition"></a></dt>
<dd><p>Number of elements in the array.</p>
<p>Equivalent to the product of the array’s dimensions.</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</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">5</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">size</span>
<span class="go">30</span>
<span class="gp">>>> </span><span class="n">np</span><span class="o">.</span><span class="n">prod</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">shape</span><span class="p">)</span>
<span class="go">30</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.NDArray.context">
<code class="descname">context</code><a class="headerlink" href="#mxnet.ndarray.NDArray.context" title="Permalink to this definition"></a></dt>
<dd><p>Device context of the array.</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">context</span>
<span class="go">cpu(0)</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">context</span><span class="p">)</span>
<span class="go"><class 'mxnet.context.Context'></span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">context</span>
<span class="go">gpu(0)</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.NDArray.dtype">
<code class="descname">dtype</code><a class="headerlink" href="#mxnet.ndarray.NDArray.dtype" title="Permalink to this definition"></a></dt>
<dd><p>Data-type of the array’s elements.</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">This NDArray’s data type.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">numpy.dtype</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">dtype</span>
<span class="go"><type 'numpy.float32'></span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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">dtype</span><span class="o">=</span><span class="s1">'int32'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">dtype</span>
<span class="go"><type 'numpy.int32'></span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.NDArray.T">
<code class="descname">T</code><a class="headerlink" href="#mxnet.ndarray.NDArray.T" title="Permalink to this definition"></a></dt>
<dd><p>Returns a copy of the array with axes transposed.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">mx.nd.transpose(self)</span></code> except that
self is returned if <code class="docutils literal"><span class="pre">self.ndim</span> <span class="pre"><</span> <span class="pre">2</span></code>.</p>
<p>Unlike <code class="docutils literal"><span class="pre">numpy.ndarray.T</span></code>, this function returns a copy
rather than a view of the array unless <code class="docutils literal"><span class="pre">self.ndim</span> <span class="pre"><</span> <span class="pre">2</span></code>.</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</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="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1., 2.],</span>
<span class="go"> [ 3., 4., 5.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">T</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 3.],</span>
<span class="go"> [ 1., 4.],</span>
<span class="go"> [ 2., 5.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.asnumpy">
<code class="descname">asnumpy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.asnumpy" title="Permalink to this definition"></a></dt>
<dd><p>Returns a <code class="docutils literal"><span class="pre">numpy.ndarray</span></code> object with value copied from this array.</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
<span class="go"><type 'numpy.ndarray'></span>
<span class="gp">>>> </span><span class="n">y</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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">dtype</span><span class="o">=</span><span class="s1">'int32'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[1, 1, 1],</span>
<span class="go"> [1, 1, 1]], dtype=int32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.asscalar">
<code class="descname">asscalar</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.asscalar" title="Permalink to this definition"></a></dt>
<dd><p>Returns a scalar whose value is copied from this array.</p>
<p>This function is equivalent to <code class="docutils literal"><span class="pre">self.asnumpy()[0]</span></code>. This NDArray must have shape (1,).</p>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">1</span><span class="p">,),</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'int32'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asscalar</span><span class="p">()</span>
<span class="go">1</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">x</span><span class="o">.</span><span class="n">asscalar</span><span class="p">())</span>
<span class="go"><type 'numpy.int32'></span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.astype">
<code class="descname">astype</code><span class="sig-paren">(</span><em>dtype</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.astype" title="Permalink to this definition"></a></dt>
<dd><p>Returns a copy of the array after casting to a specified type.</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>dtype</strong> (<em>numpy.dtype or str</em>) – The type of the returned array.</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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">dtype</span><span class="o">=</span><span class="s1">'float32'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="s1">'int32'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">dtype</span>
<span class="go"><type 'numpy.int32'></span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.copyto">
<code class="descname">copyto</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.copyto" title="Permalink to this definition"></a></dt>
<dd><p>Copies the value of this array to another array.</p>
<p>If <code class="docutils literal"><span class="pre">other</span></code> is a <code class="docutils literal"><span class="pre">NDArray</span></code> object, then <code class="docutils literal"><span class="pre">other.shape</span></code> and
<code class="docutils literal"><span class="pre">self.shape</span></code> should be the same. This function copies the value from
<code class="docutils literal"><span class="pre">self</span></code> to <code class="docutils literal"><span class="pre">other</span></code>.</p>
<p>If <code class="docutils literal"><span class="pre">other</span></code> is a context, a new <code class="docutils literal"><span class="pre">NDArray</span></code> will be first created on
the target context, and the value of <code class="docutils literal"><span class="pre">self</span></code> is copied.</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>other</strong> (<em>NDArray or Context</em>) – The destination array or context.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The copied array. If <code class="docutils literal"><span class="pre">other</span></code> is an <code class="docutils literal"><span class="pre">NDArray</span></code>, then the return value
and <code class="docutils literal"><span class="pre">other</span></code> will point to the same <code class="docutils literal"><span class="pre">NDArray</span></code>.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">copyto</span><span class="p">(</span><span class="n">y</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="ow">is</span> <span class="n">y</span>
<span class="go">True</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">copyto</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go"><NDArray 2x3 @gpu(0)></span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.copy" title="Permalink to this definition"></a></dt>
<dd><p>Makes a copy of this <code class="docutils literal"><span class="pre">NDArray</span></code>, keeping the same context.</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">The copied array</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.as_in_context">
<code class="descname">as_in_context</code><span class="sig-paren">(</span><em>context</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.as_in_context" title="Permalink to this definition"></a></dt>
<dd><p>Returns an array on the target device with the same value as this array.</p>
<p>If the target context is the same as <code class="docutils literal"><span class="pre">self.context</span></code>, then <code class="docutils literal"><span class="pre">self</span></code> is
returned. Otherwise, a copy is made.</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>context</strong> (<em>Context</em>) – The target context.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">The target array.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">as_in_context</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">cpu</span><span class="p">())</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="ow">is</span> <span class="n">x</span>
<span class="go">True</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">as_in_context</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="ow">is</span> <span class="n">x</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.detach">
<code class="descname">detach</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.detach" title="Permalink to this definition"></a></dt>
<dd><p>Returns a new NDArray, detached from the current graph.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.NDArray.backward">
<code class="descname">backward</code><span class="sig-paren">(</span><em>out_grad=None</em>, <em>retain_graph=False</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.NDArray.backward" title="Permalink to this definition"></a></dt>
<dd><p>Compute the gradients of this NDArray w.r.t variables.</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>out_grad</strong> (<em>list of NDArray or None</em>) – </td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.onehot_encode">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">onehot_encode</code><span class="sig-paren">(</span><em>indices</em>, <em>out</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.onehot_encode" title="Permalink to this definition"></a></dt>
<dd><p>One-hot encoding indices into matrix out.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>onehot_encode</cite> is deprecated. Use <cite>one_hot</cite> instead.</p>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.empty">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">empty</code><span class="sig-paren">(</span><em>shape</em>, <em>ctx=None</em>, <em>dtype=<Mock name='mock.float32' id='47711027887120'></em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.empty" title="Permalink to this definition"></a></dt>
<dd><p>Returns a new array of given shape and type, without initializing entries.</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>shape</strong> (<em>int or tuple of int</em>) – The shape of the empty array.</li>
<li><strong>ctx</strong> (<em>Context, optional</em>) – An optional device context (default is the current default context).</li>
<li><strong>dtype</strong> (<em>str or numpy.dtype, optional</em>) – An optional value type (default is <cite>float32</cite>).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A created array.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">empty</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="go"><NDArray 1 @cpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">empty</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go"><NDArray 1x2 @gpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">empty</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="s1">'float16'</span><span class="p">)</span>
<span class="go"><NDArray 1x2 @gpu(0)></span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.zeros">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">zeros</code><span class="sig-paren">(</span><em>shape</em>, <em>ctx=None</em>, <em>dtype=<Mock name='mock.float32' id='47711027887120'></em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.zeros" title="Permalink to this definition"></a></dt>
<dd><p>Returns a new array filled with all zeros, with the given shape and type.</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>shape</strong> (<em>int or tuple of int</em>) – The shape of the empty array.</li>
<li><strong>ctx</strong> (<em>Context, optional</em>) – An optional device context (default is the current default context).</li>
<li><strong>dtype</strong> (<em>str or numpy.dtype, optional</em>) – An optional value type (default is <cite>float32</cite>).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray (default is <cite>None</cite>).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A created array</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 0.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go"><NDArray 1x2 @gpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">),</span> <span class="s1">'float16'</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0.]], dtype=float16)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.ones">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">ones</code><span class="sig-paren">(</span><em>shape</em>, <em>ctx=None</em>, <em>dtype=<Mock name='mock.float32' id='47711027887120'></em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.ones" title="Permalink to this definition"></a></dt>
<dd><p>Returns a new array filled with all ones, with the given shape and type.</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>shape</strong> (<em>int or tuple of int or list of int</em>) – The shape of the empty array.</li>
<li><strong>ctx</strong> (<em>Context, optional</em>) – An optional device context.
Defaults to the current default context (<code class="docutils literal"><span class="pre">mxnet.Context.default_ctx</span></code>).</li>
<li><strong>dtype</strong> (<em>str or numpy.dtype, optional</em>) – An optional value type (default is <cite>float32</cite>).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray (default is <cite>None</cite>).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A new array of the specified shape filled with all ones.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 1.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go"><NDArray 1x2 @gpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'float16'</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1.]], dtype=float16)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.full">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">full</code><span class="sig-paren">(</span><em>shape</em>, <em>val</em>, <em>ctx=None</em>, <em>dtype=<Mock name='mock.float32' id='47711027887120'></em>, <em>out=None</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.full" title="Permalink to this definition"></a></dt>
<dd><p>Returns a new array of given shape and type, filled with the given value <cite>val</cite>.</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>shape</strong> (<em>int or tuple of int</em>) – The shape of the new array.</li>
<li><strong>val</strong> (<em>scalar</em>) – Fill value.</li>
<li><strong>ctx</strong> (<em>Context, optional</em>) – Device context (default is the current default context).</li>
<li><strong>dtype</strong> (<cite>str</cite> or <cite>numpy.dtype</cite>, optional) – The data type of the returned <cite>NDArray</cite>. The default datatype is <cite>float32</cite>.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray (default is <cite>None</cite>).</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><cite>NDArray</cite> filled with <cite>val</cite>, with the given shape, ctx, and dtype.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mf">2.0</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 2.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">full</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="mf">2.0</span><span class="p">,</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go"><NDArray 1x2 @gpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">full</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">),</span> <span class="mf">2.0</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'float16'</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2.]], dtype=float16)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.array">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">array</code><span class="sig-paren">(</span><em>source_array</em>, <em>ctx=None</em>, <em>dtype=None</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.array" title="Permalink to this definition"></a></dt>
<dd><p>Creates an array from any object exposing the array interface.</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>source_array</strong> (<em>array_like</em>) – An object exposing the array interface, an object whose <cite>__array__</cite>
method returns an array, or any (nested) sequence.</li>
<li><strong>ctx</strong> (<em>Context, optional</em>) – Device context (default is the current default context).</li>
<li><strong>dtype</strong> (<em>str or numpy.dtype, optional</em>) – The data type of the output array. The default dtype is <code class="docutils literal"><span class="pre">source_array.dtype</span></code>
if <cite>source_array</cite> is an <cite>NDArray</cite>, <cite>float32</cite> otherwise.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <cite>NDArray</cite> with the same contents as the <cite>source_array</cite>.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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="go"><NDArray 3 @cpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]])</span>
<span class="go"><NDArray 2x2 @cpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">(</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">2</span><span class="p">)))</span>
<span class="go"><NDArray 3x2 @cpu(0)></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">(</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">2</span><span class="p">)),</span> <span class="n">mx</span><span class="o">.</span><span class="n">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">))</span>
<span class="go"><NDArray 3x2 @gpu(0)></span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.moveaxis">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">moveaxis</code><span class="sig-paren">(</span><em>tensor</em>, <em>source</em>, <em>destination</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.moveaxis" title="Permalink to this definition"></a></dt>
<dd><p>Moves the <cite>source</cite> axis into the <cite>destination</cite> position
while leaving the other axes in their original order</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>tensor</strong> (<em>mx.nd.array</em>) – The array which axes should be reordered</li>
<li><strong>source</strong> (<em>int</em>) – Original position of the axes to move.</li>
<li><strong>destination</strong> (<em>int</em>) – Destination position for each of the original axes.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>result</strong>
Array with moved axes.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">mx.nd.array</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">X</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mi">1</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="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]])</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">moveaxis</span><span class="p">(</span><span class="n">X</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="o">.</span><span class="n">shape</span>
<span class="go">(3L, 2L)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.arange">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">arange</code><span class="sig-paren">(</span><em>start</em>, <em>stop=None</em>, <em>step=1.0</em>, <em>repeat=1</em>, <em>ctx=None</em>, <em>dtype=<Mock name='mock.float32' id='47711027887120'></em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.arange" title="Permalink to this definition"></a></dt>
<dd><p>Returns evenly spaced values within a given interval.</p>
<p>Values are generated within the half-open interval [<cite>start</cite>, <cite>stop</cite>). In other
words, the interval includes <cite>start</cite> but excludes <cite>stop</cite>. The function is
similar to the built-in Python function <cite>range</cite> and to <cite>numpy.arange</cite>,
but returns an <cite>NDArray</cite>.</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>start</strong> (<em>float, optional</em>) – Start of interval. The default start value is 0.</li>
<li><strong>stop</strong> (<em>float</em>) – End of interval.</li>
<li><strong>step</strong> (<em>float, optional</em>) – Spacing between values. The default step size is 1.</li>
<li><strong>repeat</strong> (<em>int, optional</em>) – Number of times to repeat each element. The default repeat count is 1.</li>
<li><strong>ctx</strong> (<em>Context, optional</em>) – Device context. Default context is the current default context.</li>
<li><strong>dtype</strong> (<em>str or numpy.dtype, optional</em>) – The data type of the <cite>NDArray</cite>. The default datatype is <cite>np.float32</cite>.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><cite>NDArray</cite> of evenly spaced values in the specified range.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 0., 1., 2.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 2., 3., 4., 5.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 2., 4.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mf">1.5</span><span class="p">,</span> <span class="n">repeat</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 2. , 2. , 3.5, 3.5, 5. , 5. ], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="n">step</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">repeat</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'int32'</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([2, 2, 2, 4, 4, 4], dtype=int32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.add">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">add</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.add" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise sum of the input arrays with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">+</span> <span class="pre">rhs</span></code>, <code class="docutils literal"><span class="pre">mx.nd.broadcast_add(lhs,</span> <span class="pre">rhs)</span></code> and
<code class="docutils literal"><span class="pre">mx.nd.broadcast_plus(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be added.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be added.
If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The element-wise sum of the input arrays.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">+</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">+</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">add</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o">+</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.],</span>
<span class="go"> [ 1., 2.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.subtract">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">subtract</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.subtract" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise difference of the input arrays with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">-</span> <span class="pre">rhs</span></code>, <code class="docutils literal"><span class="pre">mx.nd.broadcast_sub(lhs,</span> <span class="pre">rhs)</span></code> and
<code class="docutils literal"><span class="pre">mx.nd.broadcast_minus(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be subtracted.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be subtracted.
If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The element-wise difference of the input arrays.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">-</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[-1., -1., -1.],</span>
<span class="go"> [-1., -1., -1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">-</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">subtract</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span><span class="o">-</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.],</span>
<span class="go"> [-1., 0.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.multiply">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">multiply</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.multiply" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise product of the input arrays with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">*</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_mul(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be multiplied.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be multiplied.
If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The element-wise multiplication of the input arrays.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">*</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">multiply</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span><span class="o">*</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0.],</span>
<span class="go"> [ 0., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.divide">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">divide</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.divide" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise division of the input arrays with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">/</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_div(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array in division.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array in division.
The arrays to be divided. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The element-wise division of the input arrays.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="o">*</span><span class="mi">6</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span><span class="o">*</span><span class="mi">2</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 6., 6., 6.],</span>
<span class="go"> [ 6., 6., 6.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2.],</span>
<span class="go"> [ 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">/</span><span class="mi">2</span>
<span class="go"><NDArray 2x3 @cpu(0)></span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">/</span><span class="mi">3</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">/</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">divide</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 3., 3., 3.],</span>
<span class="go"> [ 3., 3., 3.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.modulo">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">modulo</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.modulo" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise modulo of the input arrays with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">%</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_mod(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array in modulo.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array in modulo.
The arrays to be taken modulo. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The element-wise modulo of the input arrays.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="o">*</span><span class="mi">6</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span><span class="o">*</span><span class="mi">4</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 6., 6., 6.],</span>
<span class="go"> [ 6., 6., 6.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 4.],</span>
<span class="go"> [ 4.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">%</span><span class="mi">5</span>
<span class="go"><NDArray 2x3 @cpu(0)></span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">%</span><span class="mi">5</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">%</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">modulo</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.power">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">power</code><span class="sig-paren">(</span><em>base</em>, <em>exp</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.power" title="Permalink to this definition"></a></dt>
<dd><p>Returns result of first array elements raised to powers from second array, element-wise
with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">base</span> <span class="pre">**</span> <span class="pre">exp</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_power(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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>base</strong> (<em>scalar or NDArray</em>) – The base array</li>
<li><strong>exp</strong> (<em>scalar or NDArray</em>) – The exponent array. If <code class="docutils literal"><span class="pre">base.shape</span> <span class="pre">!=</span> <span class="pre">exp.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The bases in x raised to the exponents in y.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="o">*</span><span class="mi">2</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</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="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</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="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1.],</span>
<span class="go"> [ 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1.],</span>
<span class="go"> [ 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 4., 4., 4.],</span>
<span class="go"> [ 4., 4., 4.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">**</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 4., 4., 4.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">power</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 4., 4., 4.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span><span class="o">**</span><span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1.],</span>
<span class="go"> [ 4.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.maximum">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">maximum</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.maximum" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise maximum of the input arrays with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">mx.nd.broadcast_maximum(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The element-wise maximum of the input arrays.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">maximum</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 2., 2., 2.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">maximum</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">maximum</span><span class="p">(</span><span class="n">y</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.],</span>
<span class="go"> [ 1., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.minimum">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">minimum</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.minimum" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise minimum of the input arrays with broadcasting.</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">mx.nd.broadcast_minimum(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">The element-wise minimum of the input arrays.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">minimum</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">minimum</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">minimum</span><span class="p">(</span><span class="n">z</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0.],</span>
<span class="go"> [ 0., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">equal</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>equal to</strong> (==) comparison operation with
broadcasting.</p>
<p>For each element in input arrays, return 1(true) if corresponding elements are same,
otherwise return 0(false).</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">==</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_equal(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Output array of boolean values.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">equal</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o">==</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 0.],</span>
<span class="go"> [ 0., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.not_equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">not_equal</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.not_equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>not equal to</strong> (!=) comparison operation
with broadcasting.</p>
<p>For each element in input arrays, return 1(true) if corresponding elements are different,
otherwise return 0(false).</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">!=</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_not_equal(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Output array of boolean values.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o">==</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 0.],</span>
<span class="go"> [ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">!=</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">!=</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">not_equal</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o">!=</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.],</span>
<span class="go"> [ 1., 0.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.greater">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">greater</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.greater" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>greater than</strong> (>) comparison operation
with broadcasting.</p>
<p>For each element in input arrays, return 1(true) if lhs elements are greater than rhs,
otherwise return 0(false).</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">></span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_greater(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Output array of boolean values.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">></span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">></span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">greater</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o">></span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.],</span>
<span class="go"> [ 0., 0.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.greater_equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">greater_equal</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.greater_equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>greater than or equal to</strong> (>=) comparison
operation with broadcasting.</p>
<p>For each element in input arrays, return 1(true) if lhs elements are greater than equal to rhs,
otherwise return 0(false).</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre">>=</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_greater_equal(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Output array of boolean values.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">>=</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o">>=</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">greater_equal</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o">>=</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1.],</span>
<span class="go"> [ 0., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.lesser">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">lesser</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.lesser" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>lesser than</strong> (<) comparison operation
with broadcasting.</p>
<p>For each element in input arrays, return 1(true) if lhs elements are less than rhs,
otherwise return 0(false).</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre"><</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_lesser(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Output array of boolean values.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o"><</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o"><</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">lesser</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o"><</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0.],</span>
<span class="go"> [ 1., 0.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.lesser_equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">lesser_equal</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.lesser_equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>lesser than or equal to</strong> (<=) comparison
operation with broadcasting.</p>
<p>For each element in input arrays, return 1(true) if lhs elements are
lesser than equal to rhs, otherwise return 0(false).</p>
<p>Equivalent to <code class="docutils literal"><span class="pre">lhs</span> <span class="pre"><=</span> <span class="pre">rhs</span></code> and <code class="docutils literal"><span class="pre">mx.nd.broadcast_lesser_equal(lhs,</span> <span class="pre">rhs)</span></code>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the corresponding dimensions of two arrays have the same size or one of them has size 1,
then the arrays are broadcastable to a common shape.</p>
</div>
<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> (<em>scalar or array</em>) – First array to be compared.</li>
<li><strong>rhs</strong> (<em>scalar or array</em>) – Second array to be compared. If <code class="docutils literal"><span class="pre">lhs.shape</span> <span class="pre">!=</span> <span class="pre">rhs.shape</span></code>, they must be
broadcastable to a common shape.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Output array of boolean values.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span><span class="o">.</span><span class="n">reshape</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0.],</span>
<span class="go"> [ 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o"><=</span> <span class="mi">1</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 1., 1.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span> <span class="o"><=</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">lesser_equal</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">z</span> <span class="o"><=</span> <span class="n">y</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 0.],</span>
<span class="go"> [ 1., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.true_divide">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">true_divide</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.true_divide" title="Permalink to this definition"></a></dt>
<dd><p>This function is similar to <a class="reference internal" href="#mxnet.ndarray.divide" title="mxnet.ndarray.divide"><code class="xref py py-meth docutils literal"><span class="pre">divide()</span></code></a>.</p>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.negative">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">negative</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.negative" title="Permalink to this definition"></a></dt>
<dd><p>Negate src</p>
<p>From:src/operator/tensor/elemwise_unary_op.cc:206</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.load">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">load</code><span class="sig-paren">(</span><em>fname</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.load" title="Permalink to this definition"></a></dt>
<dd><p>Loads an array from file.</p>
<p>See more details in <code class="docutils literal"><span class="pre">save</span></code>.</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>fname</strong> (<em>str</em>) – The filename.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Loaded data.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">list of NDArray or dict of str to NDArray</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.save">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">save</code><span class="sig-paren">(</span><em>fname</em>, <em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.save" title="Permalink to this definition"></a></dt>
<dd><p>Saves a list of arrays or a dict of str->array to file.</p>
<p>Examples of filenames:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">/path/to/file</span></code></li>
<li><code class="docutils literal"><span class="pre">s3://my-bucket/path/to/file</span></code> (if compiled with AWS S3 supports)</li>
<li><code class="docutils literal"><span class="pre">hdfs://path/to/file</span></code> (if compiled with HDFS supports)</li>
</ul>
<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>fname</strong> (<em>str</em>) – The filename.</li>
<li><strong>data</strong> (list of <code class="docutils literal"><span class="pre">NDArray`</span> <span class="pre">or</span> <span class="pre">dict</span> <span class="pre">of</span> <span class="pre">str</span> <span class="pre">to</span> <span class="pre">``NDArray</span></code>) – The data to save.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">zeros</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="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</span><span class="p">((</span><span class="mi">1</span><span class="p">,</span><span class="mi">4</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s1">'my_list'</span><span class="p">,</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="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s1">'my_dict'</span><span class="p">,</span> <span class="p">{</span><span class="s1">'x'</span><span class="p">:</span><span class="n">x</span><span class="p">,</span> <span class="s1">'y'</span><span class="p">:</span><span class="n">y</span><span class="p">})</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">'my_list'</span><span class="p">)</span>
<span class="go">[<NDArray 2x3 @cpu(0)>, <NDArray 1x4 @cpu(0)>]</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="s1">'my_dict'</span><span class="p">)</span>
<span class="go">{'y': <NDArray 1x4 @cpu(0)>, 'x': <NDArray 2x3 @cpu(0)>}</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.concatenate">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">concatenate</code><span class="sig-paren">(</span><em>arrays</em>, <em>axis=0</em>, <em>always_copy=True</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.concatenate" title="Permalink to this definition"></a></dt>
<dd><p>DEPRECATED, use <code class="docutils literal"><span class="pre">concat</span></code> instead</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>arrays</strong> (list of <cite>NDArray</cite>) – Arrays to be concatenate. They must have identical shape except
the first dimension. They also must have the same data type.</li>
<li><strong>axis</strong> (<em>int</em>) – The axis along which to concatenate.</li>
<li><strong>always_copy</strong> (<em>bool</em>) – Default <cite>True</cite>. When not <cite>True</cite>, if the arrays only contain one
<cite>NDArray</cite>, that element will be returned directly, avoid copying.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <cite>NDArray</cite> that lives on the same context as <cite>arrays[0].context</cite>.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last"><a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.imdecode">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">imdecode</code><span class="sig-paren">(</span><em>str_img</em>, <em>clip_rect=(0</em>, <em>0</em>, <em>0</em>, <em>0)</em>, <em>out=None</em>, <em>index=0</em>, <em>channels=3</em>, <em>mean=None</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.imdecode" title="Permalink to this definition"></a></dt>
<dd><p>DEPRECATED, use mx.img instead</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>str_img</strong> (<em>str</em>) – Binary image data</li>
<li><strong>clip_rect</strong> (<em>iterable of 4 int</em>) – Clip decoded image to rectangle (x0, y0, x1, y1).</li>
<li><strong>out</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Output buffer. Can be 3 dimensional (c, h, w) or 4 dimensional (n, c, h, w).</li>
<li><strong>index</strong> (<em>int</em>) – Output decoded image to i-th slice of 4 dimensional buffer.</li>
<li><strong>channels</strong> (<em>int</em>) – Number of channels to output. Decode to grey scale when channels = 1.</li>
<li><strong>mean</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Subtract mean from decode image before outputing.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Activation">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Activation</code><span class="sig-paren">(</span><em>data=None</em>, <em>act_type=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Activation" title="Permalink to this definition"></a></dt>
<dd><p>Applies an activation function element-wise to the input.</p>
<p>The following activation functions are supported:</p>
<ul class="simple">
<li><cite>relu</cite>: Rectified Linear Unit, <span class="math">\(y = max(x, 0)\)</span></li>
<li><cite>sigmoid</cite>: <span class="math">\(y = \frac{1}{1 + exp(-x)}\)</span></li>
<li><cite>tanh</cite>: Hyperbolic tangent, <span class="math">\(y = \frac{exp(x) - exp(-x)}{exp(x) + exp(-x)}\)</span></li>
<li><cite>softrelu</cite>: Soft ReLU, or SoftPlus, <span class="math">\(y = log(1 + exp(x))\)</span></li>
</ul>
<p>Defined in src/operator/activation.cc:L77</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array to activation function.</li>
<li><strong>act_type</strong> (<em>{'relu', 'sigmoid', 'softrelu', 'tanh'}, required</em>) – Activation function to be applied.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.BatchNorm">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">BatchNorm</code><span class="sig-paren">(</span><em>data=None</em>, <em>gamma=None</em>, <em>beta=None</em>, <em>moving_mean=None</em>, <em>moving_var=None</em>, <em>eps=_Null</em>, <em>momentum=_Null</em>, <em>fix_gamma=_Null</em>, <em>use_global_stats=_Null</em>, <em>output_mean_var=_Null</em>, <em>axis=_Null</em>, <em>cudnn_off=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.BatchNorm" title="Permalink to this definition"></a></dt>
<dd><p>Batch normalization.</p>
<p>Normalizes a data batch by mean and variance, and applies a scale <code class="docutils literal"><span class="pre">gamma</span></code> as
well as offset <code class="docutils literal"><span class="pre">beta</span></code>.</p>
<p>Assume the input has more than one dimension and we normalize along axis 1.
We first compute the mean and variance along this axis:</p>
<div class="math">
\[\begin{split}data\_mean[i] = mean(data[:,i,:,...]) \\
data\_var[i] = var(data[:,i,:,...])\end{split}\]</div>
<p>Then compute the normalized output, which has the same shape as input, as following:</p>
<div class="math">
\[out[:,i,:,...] = \frac{data[:,i,:,...] - data\_mean[i]}{\sqrt{data\_var[i]+\epsilon}} * gamma[i] + beta[i]\]</div>
<p>Both <em>mean</em> and <em>var</em> returns a scalar by treating the input as a vector.</p>
<p>Assume the input has size <em>k</em> on axis 1, then both <code class="docutils literal"><span class="pre">gamma</span></code> and <code class="docutils literal"><span class="pre">beta</span></code>
have shape <em>(k,)</em>. If <code class="docutils literal"><span class="pre">output_mean_var</span></code> is set to be true, then outputs both <code class="docutils literal"><span class="pre">data_mean</span></code> and
<code class="docutils literal"><span class="pre">data_var</span></code> as well, which are needed for the backward pass.</p>
<p>Besides the inputs and the outputs, this operator accepts two auxiliary
states, <code class="docutils literal"><span class="pre">moving_mean</span></code> and <code class="docutils literal"><span class="pre">moving_var</span></code>, which are <em>k</em>-length
vectors. They are global statistics for the whole dataset, which are updated
by:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">moving_mean</span> <span class="o">=</span> <span class="n">moving_mean</span> <span class="o">*</span> <span class="n">momentum</span> <span class="o">+</span> <span class="n">data_mean</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">momentum</span><span class="p">)</span>
<span class="n">moving_var</span> <span class="o">=</span> <span class="n">moving_var</span> <span class="o">*</span> <span class="n">momentum</span> <span class="o">+</span> <span class="n">data_var</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">momentum</span><span class="p">)</span>
</pre></div>
</div>
<p>If <code class="docutils literal"><span class="pre">use_global_stats</span></code> is set to be true, then <code class="docutils literal"><span class="pre">moving_mean</span></code> and
<code class="docutils literal"><span class="pre">moving_var</span></code> are used instead of <code class="docutils literal"><span class="pre">data_mean</span></code> and <code class="docutils literal"><span class="pre">data_var</span></code> to compute
the output. It is often used during inference.</p>
<p>The parameter <code class="docutils literal"><span class="pre">axis</span></code> specifies which axis of the input shape denotes
the ‘channel’ (separately normalized groups). The default is 1. Specifying -1 sets the channel
axis to be the last item in the input shape.</p>
<p>Both <code class="docutils literal"><span class="pre">gamma</span></code> and <code class="docutils literal"><span class="pre">beta</span></code> are learnable parameters. But if <code class="docutils literal"><span class="pre">fix_gamma</span></code> is true,
then set <code class="docutils literal"><span class="pre">gamma</span></code> to 1 and its gradient to 0.</p>
<p>Defined in src/operator/batch_norm.cc:L396</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to batch normalization</li>
<li><strong>gamma</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – gamma array</li>
<li><strong>beta</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – beta array</li>
<li><strong>moving_mean</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – running mean of input</li>
<li><strong>moving_var</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – running variance of input</li>
<li><strong>eps</strong> (<em>float, optional, default=0.001</em>) – Epsilon to prevent div 0. Must be bigger than CUDNN_BN_MIN_EPSILON defined in cudnn.h when using cudnn (usually 1e-5)</li>
<li><strong>momentum</strong> (<em>float, optional, default=0.9</em>) – Momentum for moving average</li>
<li><strong>fix_gamma</strong> (<em>boolean, optional, default=True</em>) – Fix gamma while training</li>
<li><strong>use_global_stats</strong> (<em>boolean, optional, default=False</em>) – Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.</li>
<li><strong>output_mean_var</strong> (<em>boolean, optional, default=False</em>) – Output All,normal mean and var</li>
<li><strong>axis</strong> (<em>int, optional, default='1'</em>) – Specify which shape axis the channel is specified</li>
<li><strong>cudnn_off</strong> (<em>boolean, optional, default=False</em>) – Do not select CUDNN operator, if available</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.BatchNorm_v1">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">BatchNorm_v1</code><span class="sig-paren">(</span><em>data=None</em>, <em>gamma=None</em>, <em>beta=None</em>, <em>eps=_Null</em>, <em>momentum=_Null</em>, <em>fix_gamma=_Null</em>, <em>use_global_stats=_Null</em>, <em>output_mean_var=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.BatchNorm_v1" title="Permalink to this definition"></a></dt>
<dd><p>Batch normalization.</p>
<p>Normalizes a data batch by mean and variance, and applies a scale <code class="docutils literal"><span class="pre">gamma</span></code> as
well as offset <code class="docutils literal"><span class="pre">beta</span></code>.</p>
<p>Assume the input has more than one dimension and we normalize along axis 1.
We first compute the mean and variance along this axis:</p>
<div class="math">
\[\begin{split}data\_mean[i] = mean(data[:,i,:,...]) \\
data\_var[i] = var(data[:,i,:,...])\end{split}\]</div>
<p>Then compute the normalized output, which has the same shape as input, as following:</p>
<div class="math">
\[out[:,i,:,...] = \frac{data[:,i,:,...] - data\_mean[i]}{\sqrt{data\_var[i]+\epsilon}} * gamma[i] + beta[i]\]</div>
<p>Both <em>mean</em> and <em>var</em> returns a scalar by treating the input as a vector.</p>
<p>Assume the input has size <em>k</em> on axis 1, then both <code class="docutils literal"><span class="pre">gamma</span></code> and <code class="docutils literal"><span class="pre">beta</span></code>
have shape <em>(k,)</em>. If <code class="docutils literal"><span class="pre">output_mean_var</span></code> is set to be true, then outputs both <code class="docutils literal"><span class="pre">data_mean</span></code> and
<code class="docutils literal"><span class="pre">data_var</span></code> as well, which are needed for the backward pass.</p>
<p>Besides the inputs and the outputs, this operator accepts two auxiliary
states, <code class="docutils literal"><span class="pre">moving_mean</span></code> and <code class="docutils literal"><span class="pre">moving_var</span></code>, which are <em>k</em>-length
vectors. They are global statistics for the whole dataset, which are updated
by:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">moving_mean</span> <span class="o">=</span> <span class="n">moving_mean</span> <span class="o">*</span> <span class="n">momentum</span> <span class="o">+</span> <span class="n">data_mean</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">momentum</span><span class="p">)</span>
<span class="n">moving_var</span> <span class="o">=</span> <span class="n">moving_var</span> <span class="o">*</span> <span class="n">momentum</span> <span class="o">+</span> <span class="n">data_var</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">momentum</span><span class="p">)</span>
</pre></div>
</div>
<p>If <code class="docutils literal"><span class="pre">use_global_stats</span></code> is set to be true, then <code class="docutils literal"><span class="pre">moving_mean</span></code> and
<code class="docutils literal"><span class="pre">moving_var</span></code> are used instead of <code class="docutils literal"><span class="pre">data_mean</span></code> and <code class="docutils literal"><span class="pre">data_var</span></code> to compute
the output. It is often used during inference.</p>
<p>Both <code class="docutils literal"><span class="pre">gamma</span></code> and <code class="docutils literal"><span class="pre">beta</span></code> are learnable parameters. But if <code class="docutils literal"><span class="pre">fix_gamma</span></code> is true,
then set <code class="docutils literal"><span class="pre">gamma</span></code> to 1 and its gradient to 0.</p>
<p>Defined in src/operator/batch_norm_v1.cc:L71</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to batch normalization</li>
<li><strong>gamma</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – gamma array</li>
<li><strong>beta</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – beta array</li>
<li><strong>eps</strong> (<em>float, optional, default=0.001</em>) – Epsilon to prevent div 0</li>
<li><strong>momentum</strong> (<em>float, optional, default=0.9</em>) – Momentum for moving average</li>
<li><strong>fix_gamma</strong> (<em>boolean, optional, default=True</em>) – Fix gamma while training</li>
<li><strong>use_global_stats</strong> (<em>boolean, optional, default=False</em>) – Whether use global moving statistics instead of local batch-norm. This will force change batch-norm into a scale shift operator.</li>
<li><strong>output_mean_var</strong> (<em>boolean, optional, default=False</em>) – Output All,normal mean and var</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.BilinearSampler">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">BilinearSampler</code><span class="sig-paren">(</span><em>data=None</em>, <em>grid=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.BilinearSampler" title="Permalink to this definition"></a></dt>
<dd><dl class="docutils">
<dt>Applies bilinear sampling to input feature map, which is the key of “[NIPS2015] Spatial Transformer Networks”</dt>
<dd>output[batch, channel, y_dst, x_dst] = G(data[batch, channel, y_src, x_src)
x_dst, y_dst enumerate all spatial locations in output
x_src = grid[batch, 0, y_dst, x_dst]
y_src = grid[batch, 1, y_dst, x_dst]
G() denotes the bilinear interpolation kernel</dd>
</dl>
<p>The out-boundary points will be padded as zeros. (The boundary is defined to be [-1, 1])
The shape of output will be (data.shape[0], data.shape[1], grid.shape[2], grid.shape[3])
The operator assumes that grid has been nomalized. If you want to design a CustomOp to manipulate grid, please refer to GridGeneratorOp.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the BilinearsamplerOp.</li>
<li><strong>grid</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input grid to the BilinearsamplerOp.grid has two channels: x_src, y_src</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.BlockGrad">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">BlockGrad</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.BlockGrad" title="Permalink to this definition"></a></dt>
<dd><p>Stops gradient computation.</p>
<p>Stops the accumulated gradient of the inputs from flowing through this operator
in the backward direction. In other words, this operator prevents the contribution
of its inputs to be taken into account for computing gradients.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>v1 = [1, 2]
v2 = [0, 1]
a = Variable('a')
b = Variable('b')
b_stop_grad = stop_gradient(3 * b)
loss = MakeLoss(b_stop_grad + a)
executor = loss.simple_bind(ctx=cpu(), a=(1,2), b=(1,2))
executor.forward(is_train=True, a=v1, b=v2)
executor.outputs
[ 1. 5.]
executor.backward()
executor.grad_arrays
[ 0. 0.]
[ 1. 1.]
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L99</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Cast">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Cast</code><span class="sig-paren">(</span><em>data=None</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Cast" title="Permalink to this definition"></a></dt>
<dd><p>Casts all elements of the input to a new type.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">Cast</span></code> is deprecated. Use <code class="docutils literal"><span class="pre">cast</span></code> instead.</p>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">cast</span><span class="p">([</span><span class="mf">0.9</span><span class="p">,</span> <span class="mf">1.3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'int32'</span><span class="p">)</span> <span class="o">=</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="n">cast</span><span class="p">([</span><span class="mf">1e20</span><span class="p">,</span> <span class="mf">11.1</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'float16'</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="n">inf</span><span class="p">,</span> <span class="mf">11.09375</span><span class="p">]</span>
<span class="n">cast</span><span class="p">([</span><span class="mi">300</span><span class="p">,</span> <span class="mf">11.1</span><span class="p">,</span> <span class="mf">10.9</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'uint8'</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="mi">44</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">253</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L175</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input.</li>
<li><strong>dtype</strong> (<em>{'float16', 'float32', 'float64', 'int32', 'uint8'}, required</em>) – Output data type.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Concat">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Concat</code><span class="sig-paren">(</span><em>*data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Concat" title="Permalink to this definition"></a></dt>
<dd><p>Joins input arrays along a given axis.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>Concat</cite> is deprecated. Use <cite>concat</cite> instead.</p>
</div>
<p>The dimensions of the input arrays should be the same except the axis along
which they will be concatenated.
The dimension of the output array along the concatenated axis will be equal
to the sum of the corresponding dimensions of the input arrays.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[1,1],[2,2]]
y = [[3,3],[4,4],[5,5]]
z = [[6,6], [7,7],[8,8]]
concat(x,y,z,dim=0) = [[ 1., 1.],
[ 2., 2.],
[ 3., 3.],
[ 4., 4.],
[ 5., 5.],
[ 6., 6.],
[ 7., 7.],
[ 8., 8.]]
Note that you cannot concat x,y,z along dimension 1 since dimension
0 is not the same for all the input arrays.
concat(y,z,dim=1) = [[ 3., 3., 6., 6.],
[ 4., 4., 7., 7.],
[ 5., 5., 8., 8.]]
</pre></div>
</div>
<p>Defined in src/operator/concat.cc:L80</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>data</strong> (<em>NDArray[]</em>) – List of arrays to concatenate</li>
<li><strong>dim</strong> (<em>int, optional, default='1'</em>) – the dimension to be concated.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Convolution">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Convolution</code><span class="sig-paren">(</span><em>data=None</em>, <em>weight=None</em>, <em>bias=None</em>, <em>kernel=_Null</em>, <em>stride=_Null</em>, <em>dilate=_Null</em>, <em>pad=_Null</em>, <em>num_filter=_Null</em>, <em>num_group=_Null</em>, <em>workspace=_Null</em>, <em>no_bias=_Null</em>, <em>cudnn_tune=_Null</em>, <em>cudnn_off=_Null</em>, <em>layout=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Convolution" title="Permalink to this definition"></a></dt>
<dd><p>Compute <em>N</em>-D convolution on <em>(N+2)</em>-D input.</p>
<p>In the 2-D convolution, given input data with shape <em>(batch_size,
channel, height, width)</em>, the output is computed by</p>
<div class="math">
\[out[n,i,:,:] = bias[i] + \sum_{j=0}^{num\_filter} data[n,j,:,:] \star
weight[i,j,:,:]\]</div>
<p>where <span class="math">\(\star\)</span> is the 2-D cross-correlation operator.</p>
<p>For general 2-D convolution, the shapes are</p>
<ul class="simple">
<li><strong>data</strong>: <em>(batch_size, channel, height, width)</em></li>
<li><strong>weight</strong>: <em>(num_filter, channel, kernel[0], kernel[1])</em></li>
<li><strong>bias</strong>: <em>(num_filter,)</em></li>
<li><strong>out</strong>: <em>(batch_size, num_filter, out_height, out_width)</em>.</li>
</ul>
<p>Define:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">p</span><span class="p">,</span><span class="n">s</span><span class="p">,</span><span class="n">d</span><span class="p">)</span> <span class="o">=</span> <span class="n">floor</span><span class="p">((</span><span class="n">x</span><span class="o">+</span><span class="mi">2</span><span class="o">*</span><span class="n">p</span><span class="o">-</span><span class="n">d</span><span class="o">*</span><span class="p">(</span><span class="n">k</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="n">s</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span>
</pre></div>
</div>
<p>then we have:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">out_height</span><span class="o">=</span><span class="n">f</span><span class="p">(</span><span class="n">height</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">dilate</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">out_width</span><span class="o">=</span><span class="n">f</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">dilate</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
</pre></div>
</div>
<p>If <code class="docutils literal"><span class="pre">no_bias</span></code> is set to be true, then the <code class="docutils literal"><span class="pre">bias</span></code> term is ignored.</p>
<p>The default data <code class="docutils literal"><span class="pre">layout</span></code> is <em>NCHW</em>, namely <em>(batch_size, channel, height,
width)</em>. We can choose other layouts such as <em>NHWC</em>.</p>
<p>If <code class="docutils literal"><span class="pre">num_group</span></code> is larger than 1, denoted by <em>g</em>, then split the input <code class="docutils literal"><span class="pre">data</span></code>
evenly into <em>g</em> parts along the channel axis, and also evenly split <code class="docutils literal"><span class="pre">weight</span></code>
along the first dimension. Next compute the convolution on the <em>i</em>-th part of
the data with the <em>i</em>-th weight part. The output is obtained by concatenating all
the <em>g</em> results.</p>
<p>1-D convolution does not have <em>height</em> dimension but only <em>width</em> in space.</p>
<ul class="simple">
<li><strong>data</strong>: <em>(batch_size, channel, width)</em></li>
<li><strong>weight</strong>: <em>(num_filter, channel, kernel[0])</em></li>
<li><strong>bias</strong>: <em>(num_filter,)</em></li>
<li><strong>out</strong>: <em>(batch_size, num_filter, out_width)</em>.</li>
</ul>
<p>3-D convolution adds an additional <em>depth</em> dimension besides <em>height</em> and
<em>width</em>. The shapes are</p>
<ul class="simple">
<li><strong>data</strong>: <em>(batch_size, channel, depth, height, width)</em></li>
<li><strong>weight</strong>: <em>(num_filter, channel, kernel[0], kernel[1], kernel[2])</em></li>
<li><strong>bias</strong>: <em>(num_filter,)</em></li>
<li><strong>out</strong>: <em>(batch_size, num_filter, out_depth, out_height, out_width)</em>.</li>
</ul>
<p>Both <code class="docutils literal"><span class="pre">weight</span></code> and <code class="docutils literal"><span class="pre">bias</span></code> are learnable parameters.</p>
<p>There are other options to tune the performance.</p>
<ul class="simple">
<li><strong>cudnn_tune</strong>: enable this option leads to higher startup time but may give
faster speed. Options are<ul>
<li><strong>off</strong>: no tuning</li>
<li><strong>limited_workspace</strong>:run test and pick the fastest algorithm that doesn’t
exceed workspace limit.</li>
<li><strong>fastest</strong>: pick the fastest algorithm and ignore workspace limit.</li>
<li><strong>None</strong> (default): the behavior is determined by environment variable
<code class="docutils literal"><span class="pre">MXNET_CUDNN_AUTOTUNE_DEFAULT</span></code>. 0 for off, 1 for limited workspace
(default), 2 for fastest.</li>
</ul>
</li>
<li><strong>workspace</strong>: A large number leads to more (GPU) memory usage but may improve
the performance.</li>
</ul>
<p>Defined in src/operator/convolution.cc:L154</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the ConvolutionOp.</li>
<li><strong>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight matrix.</li>
<li><strong>bias</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Bias parameter.</li>
<li><strong>kernel</strong> (<em>Shape(tuple), required</em>) – convolution kernel size: (h, w) or (d, h, w)</li>
<li><strong>stride</strong> (<em>Shape(tuple), optional, default=()</em>) – convolution stride: (h, w) or (d, h, w)</li>
<li><strong>dilate</strong> (<em>Shape(tuple), optional, default=()</em>) – convolution dilate: (h, w) or (d, h, w)</li>
<li><strong>pad</strong> (<em>Shape(tuple), optional, default=()</em>) – pad for convolution: (h, w) or (d, h, w)</li>
<li><strong>num_filter</strong> (<em>int (non-negative), required</em>) – convolution filter(channel) number</li>
<li><strong>num_group</strong> (<em>int (non-negative), optional, default=1</em>) – Number of group partitions.</li>
<li><strong>workspace</strong> (<em>long (non-negative), optional, default=1024</em>) – Maximum temporary workspace allowed for convolution (MB).</li>
<li><strong>no_bias</strong> (<em>boolean, optional, default=False</em>) – Whether to disable bias parameter.</li>
<li><strong>cudnn_tune</strong> (<em>{None, 'fastest', 'limited_workspace', 'off'},optional, default='None'</em>) – Whether to pick convolution algo by running performance test.</li>
<li><strong>cudnn_off</strong> (<em>boolean, optional, default=False</em>) – Turn off cudnn for this layer.</li>
<li><strong>layout</strong> (<em>{None, 'NCDHW', 'NCHW', 'NCW', 'NDHWC', 'NHWC'},optional, default='None'</em>) – Set layout for input, output and weight. Empty for
default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Convolution_v1">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Convolution_v1</code><span class="sig-paren">(</span><em>data=None</em>, <em>weight=None</em>, <em>bias=None</em>, <em>kernel=_Null</em>, <em>stride=_Null</em>, <em>dilate=_Null</em>, <em>pad=_Null</em>, <em>num_filter=_Null</em>, <em>num_group=_Null</em>, <em>workspace=_Null</em>, <em>no_bias=_Null</em>, <em>cudnn_tune=_Null</em>, <em>cudnn_off=_Null</em>, <em>layout=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Convolution_v1" title="Permalink to this definition"></a></dt>
<dd><p>This operator is DEPRECATED. Apply convolution to input then add a bias.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the ConvolutionV1Op.</li>
<li><strong>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight matrix.</li>
<li><strong>bias</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Bias parameter.</li>
<li><strong>kernel</strong> (<em>Shape(tuple), required</em>) – convolution kernel size: (h, w) or (d, h, w)</li>
<li><strong>stride</strong> (<em>Shape(tuple), optional, default=()</em>) – convolution stride: (h, w) or (d, h, w)</li>
<li><strong>dilate</strong> (<em>Shape(tuple), optional, default=()</em>) – convolution dilate: (h, w) or (d, h, w)</li>
<li><strong>pad</strong> (<em>Shape(tuple), optional, default=()</em>) – pad for convolution: (h, w) or (d, h, w)</li>
<li><strong>num_filter</strong> (<em>int (non-negative), required</em>) – convolution filter(channel) number</li>
<li><strong>num_group</strong> (<em>int (non-negative), optional, default=1</em>) – Number of group partitions. Equivalent to slicing input into num_group
partitions, apply convolution on each, then concatenate the results</li>
<li><strong>workspace</strong> (<em>long (non-negative), optional, default=1024</em>) – Maximum tmp workspace allowed for convolution (MB).</li>
<li><strong>no_bias</strong> (<em>boolean, optional, default=False</em>) – Whether to disable bias parameter.</li>
<li><strong>cudnn_tune</strong> (<em>{None, 'fastest', 'limited_workspace', 'off'},optional, default='None'</em>) – Whether to pick convolution algo by running performance test.
Leads to higher startup time but may give faster speed. Options are:
‘off’: no tuning
‘limited_workspace’: run test and pick the fastest algorithm that doesn’t exceed workspace limit.
‘fastest’: pick the fastest algorithm and ignore workspace limit.
If set to None (default), behavior is determined by environment
variable MXNET_CUDNN_AUTOTUNE_DEFAULT: 0 for off,
1 for limited workspace (default), 2 for fastest.</li>
<li><strong>cudnn_off</strong> (<em>boolean, optional, default=False</em>) – Turn off cudnn for this layer.</li>
<li><strong>layout</strong> (<em>{None, 'NCDHW', 'NCHW', 'NDHWC', 'NHWC'},optional, default='None'</em>) – Set layout for input, output and weight. Empty for
default layout: NCHW for 2d and NCDHW for 3d.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Correlation">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Correlation</code><span class="sig-paren">(</span><em>data1=None</em>, <em>data2=None</em>, <em>kernel_size=_Null</em>, <em>max_displacement=_Null</em>, <em>stride1=_Null</em>, <em>stride2=_Null</em>, <em>pad_size=_Null</em>, <em>is_multiply=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Correlation" title="Permalink to this definition"></a></dt>
<dd><p>Applies correlation to inputs.</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>data1</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data1 to the correlation.</li>
<li><strong>data2</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data2 to the correlation.</li>
<li><strong>kernel_size</strong> (<em>int (non-negative), optional, default=1</em>) – kernel size for Correlation must be an odd number</li>
<li><strong>max_displacement</strong> (<em>int (non-negative), optional, default=1</em>) – Max displacement of Correlation</li>
<li><strong>stride1</strong> (<em>int (non-negative), optional, default=1</em>) – stride1 quantize data1 globally</li>
<li><strong>stride2</strong> (<em>int (non-negative), optional, default=1</em>) – stride2 quantize data2 within the neighborhood centered around data1</li>
<li><strong>pad_size</strong> (<em>int (non-negative), optional, default=0</em>) – pad for Correlation</li>
<li><strong>is_multiply</strong> (<em>boolean, optional, default=True</em>) – operation type is either multiplication or subduction</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Crop">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Crop</code><span class="sig-paren">(</span><em>*data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Crop" title="Permalink to this definition"></a></dt>
<dd><div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>Crop</cite> is deprecated. Use <cite>slice</cite> instead.</p>
</div>
<p>Crop the 2nd and 3rd dim of input data, with the corresponding size of h_w or
with width and height of the second input symbol, i.e., with one input, we need h_w to
specify the crop height and width, otherwise the second input symbol’s size will be used</p>
<p>Defined in src/operator/crop.cc:L31</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>data</strong> (<em>Symbol or Symbol[]</em>) – Tensor or List of Tensors, the second input will be used as crop_like shape reference</li>
<li><strong>offset</strong> (<em>Shape(tuple), optional, default=(0,0)</em>) – crop offset coordinate: (y, x)</li>
<li><strong>h_w</strong> (<em>Shape(tuple), optional, default=(0,0)</em>) – crop height and width: (h, w)</li>
<li><strong>center_crop</strong> (<em>boolean, optional, default=False</em>) – If set to true, then it will use be the center_crop,or it will crop using the shape of crop_like</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Custom">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Custom</code><span class="sig-paren">(</span><em>*data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Custom" title="Permalink to this definition"></a></dt>
<dd><p>Apply a custom operator implemented in a frontend language (like Python).</p>
<p>Custom operators should override required methods like <cite>forward</cite> and <cite>backward</cite>.
The custom operator must be registered before it can be used.
Please check the tutorial here: <a class="reference external" href="http://mxnet.io/how_to/new_op.html">http://mxnet.io/how_to/new_op.html</a>.</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>data</strong> (<em>NDArray[]</em>) – Input data for the custom operator.</li>
<li><strong>op_type</strong> (<em>string</em>) – Name of the custom operator. This is the name that is passed to <cite>mx.operator.register</cite> to register the operator.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Example</p>
<p>Applies a custom operator named <cite>my_custom_operator</cite> to <cite>input</cite>.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">output</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">symbol</span><span class="o">.</span><span class="n">Custom</span><span class="p">(</span><span class="n">op_type</span><span class="o">=</span><span class="s1">'my_custom_operator'</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="nb">input</span><span class="p">)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Deconvolution">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Deconvolution</code><span class="sig-paren">(</span><em>data=None</em>, <em>weight=None</em>, <em>bias=None</em>, <em>kernel=_Null</em>, <em>stride=_Null</em>, <em>dilate=_Null</em>, <em>pad=_Null</em>, <em>adj=_Null</em>, <em>target_shape=_Null</em>, <em>num_filter=_Null</em>, <em>num_group=_Null</em>, <em>workspace=_Null</em>, <em>no_bias=_Null</em>, <em>cudnn_tune=_Null</em>, <em>cudnn_off=_Null</em>, <em>layout=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Deconvolution" title="Permalink to this definition"></a></dt>
<dd><p>Computes 2D transposed convolution (aka fractionally strided convolution) of the input tensor. This operation can be seen as the gradient of Convolution operation with respect to its input. Convolution usually reduces the size of the input. Transposed convolution works the other way, going from a smaller input to a larger output while preserving the connectivity pattern.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input tensor to the deconvolution operation.</li>
<li><strong>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weights representing the kernel.</li>
<li><strong>bias</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Bias added to the result after the deconvolution operation.</li>
<li><strong>kernel</strong> (<em>Shape(tuple), required</em>) – Deconvolution kernel size: (h, w) or (d, h, w). This is same as the kernel size used for the corresponding convolution</li>
<li><strong>stride</strong> (<em>Shape(tuple), optional, default=()</em>) – The stride used for the corresponding convolution: (h, w) or (d, h, w).</li>
<li><strong>dilate</strong> (<em>Shape(tuple), optional, default=()</em>) – Dilation factor for each dimension of the input: (h, w) or (d, h, w).</li>
<li><strong>pad</strong> (<em>Shape(tuple), optional, default=()</em>) – The amount of implicit zero padding added during convolution for each dimension of the input: (h, w) or (d, h, w). <code class="docutils literal"><span class="pre">(kernel-1)/2</span></code> is usually a good choice. If <cite>target_shape</cite> is set, <cite>pad</cite> will be ignored and a padding that will generate the target shape will be used.</li>
<li><strong>adj</strong> (<em>Shape(tuple), optional, default=()</em>) – Adjustment for output shape: (h, w) or (d, h, w). If <cite>target_shape</cite> is set, <cite>adj</cite> will be ignored and computed accordingly.</li>
<li><strong>target_shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output tensor: (h, w) or (d, h, w).</li>
<li><strong>num_filter</strong> (<em>int (non-negative), required</em>) – Number of output filters.</li>
<li><strong>num_group</strong> (<em>int (non-negative), optional, default=1</em>) – Number of groups partition.</li>
<li><strong>workspace</strong> (<em>long (non-negative), optional, default=512</em>) – Maximum temporal workspace allowed for deconvolution (MB).</li>
<li><strong>no_bias</strong> (<em>boolean, optional, default=True</em>) – Whether to disable bias parameter.</li>
<li><strong>cudnn_tune</strong> (<em>{None, 'fastest', 'limited_workspace', 'off'},optional, default='None'</em>) – Whether to pick convolution algorithm by running performance test.</li>
<li><strong>cudnn_off</strong> (<em>boolean, optional, default=False</em>) – Turn off cudnn for this layer.</li>
<li><strong>layout</strong> (<em>{None, 'NCDHW', 'NCHW', 'NCW', 'NDHWC', 'NHWC'},optional, default='None'</em>) – Set layout for input, output and weight. Empty for default layout, NCW for 1d, NCHW for 2d and NCDHW for 3d.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Dropout">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Dropout</code><span class="sig-paren">(</span><em>data=None</em>, <em>p=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Dropout" title="Permalink to this definition"></a></dt>
<dd><p>Applies dropout operation to input array.</p>
<ul class="simple">
<li>During training, each element of the input is set to zero with probability p.
The whole array is rescaled by <span class="math">\(1/(1-p)\)</span> to keep the expected
sum of the input unchanged.</li>
<li>During testing, this operator does not change the input.</li>
</ul>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>random.seed(998)
input_array = array([[3., 0.5, -0.5, 2., 7.],
[2., -0.4, 7., 3., 0.2]])
a = symbol.Variable('a')
dropout = symbol.Dropout(a, p = 0.2)
executor = dropout.simple_bind(a = input_array.shape)
## If training
executor.forward(is_train = True, a = input_array)
executor.outputs
[[ 3.75 0.625 -0. 2.5 8.75 ]
[ 2.5 -0.5 8.75 3.75 0. ]]
## If testing
executor.forward(is_train = False, a = input_array)
executor.outputs
[[ 3. 0.5 -0.5 2. 7. ]
[ 2. -0.4 7. 3. 0.2 ]]
</pre></div>
</div>
<p>Defined in src/operator/dropout.cc:L62</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array to which dropout will be applied.</li>
<li><strong>p</strong> (<em>float, optional, default=0.5</em>) – Fraction of the input that gets dropped out during training time.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.ElementWiseSum">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">ElementWiseSum</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.ElementWiseSum" title="Permalink to this definition"></a></dt>
<dd><p>Adds all input arguments element-wise.</p>
<div class="math">
\[add\_n(a_1, a_2, ..., a_n) = a_1 + a_2 + ... + a_n\]</div>
<p><code class="docutils literal"><span class="pre">add_n</span></code> is potentially more efficient than calling <code class="docutils literal"><span class="pre">add</span></code> by <cite>n</cite> times.</p>
<p>Defined in src/operator/tensor/elemwise_sum.cc:L63</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>args</strong> (<em>NDArray[]</em>) – Positional input arguments</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Embedding">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Embedding</code><span class="sig-paren">(</span><em>data=None</em>, <em>weight=None</em>, <em>input_dim=_Null</em>, <em>output_dim=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Embedding" title="Permalink to this definition"></a></dt>
<dd><p>Maps integer indices to vector representations (embeddings).</p>
<p>This operator maps words to real-valued vectors in a high-dimensional space,
called word embeddings. These embeddings can capture semantic and syntactic properties of the words.
For example, it has been noted that in the learned embedding spaces, similar words tend
to be close to each other and dissimilar words far apart.</p>
<p>For an input array of shape (d1, ..., dK),
the shape of an output array is (d1, ..., dK, output_dim).
All the input values should be integers in the range [0, input_dim).</p>
<p>If the input_dim is ip0 and output_dim is op0, then shape of the embedding weight matrix must be
(ip0, op0).</p>
<p>By default, if any index mentioned is too large, it is replaced by the index that addresses
the last vector in an embedding matrix.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>input_dim = 4
output_dim = 5
// Each row in weight matrix y represents a word. So, y = (w0,w1,w2,w3)
y = [[ 0., 1., 2., 3., 4.],
[ 5., 6., 7., 8., 9.],
[ 10., 11., 12., 13., 14.],
[ 15., 16., 17., 18., 19.]]
// Input array x represents n-grams(2-gram). So, x = [(w1,w3), (w0,w2)]
x = [[ 1., 3.],
[ 0., 2.]]
// Mapped input x to its vector representation y.
Embedding(x, y, 4, 5) = [[[ 5., 6., 7., 8., 9.],
[ 15., 16., 17., 18., 19.]],
[[ 0., 1., 2., 3., 4.],
[ 10., 11., 12., 13., 14.]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/indexing_op.cc:L55</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array to the embedding operator.</li>
<li><strong>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The embedding weight matrix.</li>
<li><strong>input_dim</strong> (<em>int, required</em>) – Vocabulary size of the input indices.</li>
<li><strong>output_dim</strong> (<em>int, required</em>) – Dimension of the embedding vectors.</li>
<li><strong>dtype</strong> (<em>{'float16', 'float32', 'float64', 'int32', 'uint8'},optional, default='float32'</em>) – Data type of weight.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Flatten">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Flatten</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Flatten" title="Permalink to this definition"></a></dt>
<dd><p>Flattens the input array into a 2-D array by collapsing the higher dimensions.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>Flatten</cite> is deprecated. Use <cite>flatten</cite> instead.</p>
</div>
<p>For an input array with shape <code class="docutils literal"><span class="pre">(d1,</span> <span class="pre">d2,</span> <span class="pre">...,</span> <span class="pre">dk)</span></code>, <cite>flatten</cite> operation reshapes
the input array into an output array of shape <code class="docutils literal"><span class="pre">(d1,</span> <span class="pre">d2*...*dk)</span></code>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span>
<span class="p">[</span><span class="mi">1</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="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">],</span>
<span class="p">[</span><span class="mi">7</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">]</span>
<span class="p">],</span>
<span class="p">[</span> <span class="p">[</span><span class="mi">1</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="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">],</span>
<span class="p">[</span><span class="mi">7</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">]</span>
<span class="p">]],</span>
<span class="n">flatten</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L131</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.FullyConnected">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">FullyConnected</code><span class="sig-paren">(</span><em>data=None</em>, <em>weight=None</em>, <em>bias=None</em>, <em>num_hidden=_Null</em>, <em>no_bias=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.FullyConnected" title="Permalink to this definition"></a></dt>
<dd><p>Applies a linear transformation: <span class="math">\(Y = XW^T + b\)</span>.</p>
<p>Shapes:</p>
<ul class="simple">
<li><strong>data</strong>: <cite>(batch_size, input_dim)</cite></li>
<li><strong>weight</strong>: <cite>(num_hidden, input_dim)</cite></li>
<li><strong>bias</strong>: <cite>(num_hidden,)</cite></li>
<li><strong>out</strong>: <cite>(batch_size, num_hidden)</cite></li>
</ul>
<p>The learnable parameters include both <code class="docutils literal"><span class="pre">weight</span></code> and <code class="docutils literal"><span class="pre">bias</span></code>.</p>
<p>If <code class="docutils literal"><span class="pre">no_bias</span></code> is set to be true, then the <code class="docutils literal"><span class="pre">bias</span></code> term is ignored.</p>
<p>Defined in src/operator/fully_connected.cc:L74</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data.</li>
<li><strong>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight matrix.</li>
<li><strong>bias</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Bias parameter.</li>
<li><strong>num_hidden</strong> (<em>int, required</em>) – Number of hidden nodes of the output.</li>
<li><strong>no_bias</strong> (<em>boolean, optional, default=False</em>) – Whether to disable bias parameter.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.GridGenerator">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">GridGenerator</code><span class="sig-paren">(</span><em>data=None</em>, <em>transform_type=_Null</em>, <em>target_shape=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.GridGenerator" title="Permalink to this definition"></a></dt>
<dd><p>Generates 2D sampling grid for bilinear sampling.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the function.</li>
<li><strong>transform_type</strong> (<em>{'affine', 'warp'}, required</em>) – The type of transformation. For <cite>affine</cite>, input data should be an affine matrix of size (batch, 6). For <cite>warp</cite>, input data should be an optical flow of size (batch, 2, h, w).</li>
<li><strong>target_shape</strong> (<em>Shape(tuple), optional, default=(0,0)</em>) – Specifies the output shape (H, W). This is required if transformation type is <cite>affine</cite>. If transformation type is <cite>warp</cite>, this parameter is ignored.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.IdentityAttachKLSparseReg">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">IdentityAttachKLSparseReg</code><span class="sig-paren">(</span><em>data=None</em>, <em>sparseness_target=_Null</em>, <em>penalty=_Null</em>, <em>momentum=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.IdentityAttachKLSparseReg" title="Permalink to this definition"></a></dt>
<dd><p>Apply a sparse regularization to the output a sigmoid activation function.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data.</li>
<li><strong>sparseness_target</strong> (<em>float, optional, default=0.1</em>) – The sparseness target</li>
<li><strong>penalty</strong> (<em>float, optional, default=0.001</em>) – The tradeoff parameter for the sparseness penalty</li>
<li><strong>momentum</strong> (<em>float, optional, default=0.9</em>) – The momentum for running average</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.InstanceNorm">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">InstanceNorm</code><span class="sig-paren">(</span><em>data=None</em>, <em>gamma=None</em>, <em>beta=None</em>, <em>eps=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.InstanceNorm" title="Permalink to this definition"></a></dt>
<dd><p>Applies instance normalization to the n-dimensional input array.</p>
<p>This operator takes an n-dimensional input array where (n>2) and normalizes
the input using the following formula:</p>
<div class="math">
\[out = \frac{x - mean[data]}{ \sqrt{Var[data]} + \epsilon} * gamma + beta\]</div>
<p>This layer is similar to batch normalization layer (<cite>BatchNorm</cite>)
with two differences: first, the normalization is
carried out per example (instance), not over a batch. Second, the
same normalization is applied both at test and train time. This
operation is also known as <cite>contrast normalization</cite>.</p>
<p>If the input data is of shape [batch, channel, spacial_dim1, spacial_dim2, ...],
<cite>gamma</cite> and <cite>beta</cite> parameters must be vectors of shape [channel].</p>
<p>This implementation is based on paper:</p>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label"/><col/></colgroup>
<tbody valign="top">
<tr><td class="label">[1]</td><td>Instance Normalization: The Missing Ingredient for Fast Stylization,
D. Ulyanov, A. Vedaldi, V. Lempitsky, 2016 (arXiv:1607.08022v2).</td></tr>
</tbody>
</table>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Input of shape (2,1,2)
x = [[[ 1.1, 2.2]],
[[ 3.3, 4.4]]]
// gamma parameter of length 1
gamma = [1.5]
// beta parameter of length 1
beta = [0.5]
// Instance normalization is calculated with the above formula
InstanceNorm(x,gamma,beta) = [[[-0.997527 , 1.99752665]],
[[-0.99752653, 1.99752724]]]
</pre></div>
</div>
<p>Defined in src/operator/instance_norm.cc:L80</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – An n-dimensional input array (n > 2) of the form [batch, channel, spatial_dim1, spatial_dim2, ...].</li>
<li><strong>gamma</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – A vector of length ‘channel’, which multiplies the normalized input.</li>
<li><strong>beta</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – A vector of length ‘channel’, which is added to the product of the normalized input and the weight.</li>
<li><strong>eps</strong> (<em>float, optional, default=0.001</em>) – An <cite>epsilon</cite> parameter to prevent division by 0.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.L2Normalization">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">L2Normalization</code><span class="sig-paren">(</span><em>data=None</em>, <em>eps=_Null</em>, <em>mode=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.L2Normalization" title="Permalink to this definition"></a></dt>
<dd><p>Normalize the input array using the L2 norm.</p>
<p>For 1-D NDArray, it computes:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">out</span> <span class="o">=</span> <span class="n">data</span> <span class="o">/</span> <span class="n">sqrt</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">data</span> <span class="o">**</span> <span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="n">eps</span><span class="p">)</span>
</pre></div>
</div>
<p>For N-D NDArray, if the input array has shape (N, N, ..., N),</p>
<p>with <code class="docutils literal"><span class="pre">mode</span></code> = <code class="docutils literal"><span class="pre">instance</span></code>, it normalizes each instance in the multidimensional
array by its L2 norm.:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>for i in 0...N
out[i,:,:,...,:] = data[i,:,:,...,:] / sqrt(sum(data[i,:,:,...,:] ** 2) + eps)
</pre></div>
</div>
<p>with <code class="docutils literal"><span class="pre">mode</span></code> = <code class="docutils literal"><span class="pre">channel</span></code>, it normalizes each channel in the array by its L2 norm.:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>for i in 0...N
out[:,i,:,...,:] = data[:,i,:,...,:] / sqrt(sum(data[:,i,:,...,:] ** 2) + eps)
</pre></div>
</div>
<p>with <code class="docutils literal"><span class="pre">mode</span></code> = <code class="docutils literal"><span class="pre">spatial</span></code>, it normalizes the cross channel norm for each position
in the array by its L2 norm.:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>for dim in 2...N
for i in 0...N
out[.....,i,...] = take(out, indices=i, axis=dim) / sqrt(sum(take(out, indices=i, axis=dim) ** 2) + eps)
-dim-
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[1,2],
[3,4]],
[[2,2],
[5,6]]]
L2Normalization(x, mode='instance')
=[[[ 0.18257418 0.36514837]
[ 0.54772252 0.73029673]]
[[ 0.24077171 0.24077171]
[ 0.60192931 0.72231513]]]
L2Normalization(x, mode='channel')
=[[[ 0.31622776 0.44721359]
[ 0.94868326 0.89442718]]
[[ 0.37139067 0.31622776]
[ 0.92847669 0.94868326]]]
L2Normalization(x, mode='spatial')
=[[[ 0.44721359 0.89442718]
[ 0.60000002 0.80000001]]
[[ 0.70710677 0.70710677]
[ 0.6401844 0.76822126]]]
</pre></div>
</div>
<p>Defined in src/operator/l2_normalization.cc:L74</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array to normalize.</li>
<li><strong>eps</strong> (<em>float, optional, default=1e-10</em>) – A small constant for numerical stability.</li>
<li><strong>mode</strong> (<em>{'channel', 'instance', 'spatial'},optional, default='instance'</em>) – Specify the dimension along which to compute L2 norm.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.LRN">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">LRN</code><span class="sig-paren">(</span><em>data=None</em>, <em>alpha=_Null</em>, <em>beta=_Null</em>, <em>knorm=_Null</em>, <em>nsize=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.LRN" title="Permalink to this definition"></a></dt>
<dd><p>Applies local response normalization to the input.</p>
<p>The local response normalization layer performs “lateral inhibition” by normalizing
over local input regions.</p>
<p>If <span class="math">\(a_{x,y}^{i}\)</span> is the activity of a neuron computed by applying kernel <span class="math">\(i\)</span> at position
<span class="math">\((x, y)\)</span> and then applying the ReLU nonlinearity, the response-normalized
activity <span class="math">\(b_{x,y}^{i}\)</span> is given by the expression:</p>
<div class="math">
\[b_{x,y}^{i} = \frac{a_{x,y}^{i}}{\Bigg({k + \alpha \sum_{j=max(0, i-\frac{n}{2})}^{min(N-1, i+\frac{n}{2})} (a_{x,y}^{j})^{2}}\Bigg)^{\beta}}\]</div>
<p>where the sum runs over <span class="math">\(n\)</span> “adjacent” kernel maps at the same spatial position, and <span class="math">\(N\)</span> is the total
number of kernels in the layer.</p>
<p>Defined in src/operator/lrn.cc:L58</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data.</li>
<li><strong>alpha</strong> (<em>float, optional, default=0.0001</em>) – The variance scaling parameter <span class="math">\(lpha\)</span> in the LRN expression.</li>
<li><strong>beta</strong> (<em>float, optional, default=0.75</em>) – The power parameter <span class="math">\(eta\)</span> in the LRN expression.</li>
<li><strong>knorm</strong> (<em>float, optional, default=2</em>) – The parameter <span class="math">\(k\)</span> in the LRN expression.</li>
<li><strong>nsize</strong> (<em>int (non-negative), required</em>) – normalization window width in elements.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.LeakyReLU">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">LeakyReLU</code><span class="sig-paren">(</span><em>data=None</em>, <em>act_type=_Null</em>, <em>slope=_Null</em>, <em>lower_bound=_Null</em>, <em>upper_bound=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.LeakyReLU" title="Permalink to this definition"></a></dt>
<dd><p>Applies Leaky rectified linear unit activation element-wise to the input.</p>
<p>Leaky ReLUs attempt to fix the “dying ReLU” problem by allowing a small <cite>slope</cite>
when the input is negative and has a slope of one when input is positive.</p>
<p>The following modified ReLU Activation functions are supported:</p>
<ul class="simple">
<li><em>elu</em>: Exponential Linear Unit. <cite>y = x > 0 ? x : slope * (exp(x)-1)</cite></li>
<li><em>leaky</em>: Leaky ReLU. <cite>y = x > 0 ? x : slope * x</cite></li>
<li><em>prelu</em>: Parametric ReLU. This is same as <em>leaky</em> except that <cite>slope</cite> is learnt during training.</li>
<li><em>rrelu</em>: Randomized ReLU. same as <em>leaky</em> but the <cite>slope</cite> is uniformly and randomly chosen from
<em>[lower_bound, upper_bound)</em> for training, while fixed to be
<em>(lower_bound+upper_bound)/2</em> for inference.</li>
</ul>
<p>Defined in src/operator/leaky_relu.cc:L39</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to activation function.</li>
<li><strong>act_type</strong> (<em>{'elu', 'leaky', 'prelu', 'rrelu'},optional, default='leaky'</em>) – Activation function to be applied.</li>
<li><strong>slope</strong> (<em>float, optional, default=0.25</em>) – Init slope for the activation. (For leaky and elu only)</li>
<li><strong>lower_bound</strong> (<em>float, optional, default=0.125</em>) – Lower bound of random slope. (For rrelu only)</li>
<li><strong>upper_bound</strong> (<em>float, optional, default=0.334</em>) – Upper bound of random slope. (For rrelu only)</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.LinearRegressionOutput">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">LinearRegressionOutput</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>grad_scale=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.LinearRegressionOutput" title="Permalink to this definition"></a></dt>
<dd><p>Computes and optimizes for squared loss during backward propagation.
Just outputs <code class="docutils literal"><span class="pre">data</span></code> during forward propagation.</p>
<p>If <span class="math">\(\hat{y}_i\)</span> is the predicted value of the i-th sample, and <span class="math">\(y_i\)</span> is the corresponding target value,
then the squared loss estimated over <span class="math">\(n\)</span> samples is defined as</p>
<p><span class="math">\(\text{SquaredLoss}(y, \hat{y} ) = \frac{1}{n} \sum_{i=0}^{n-1} \left( y_i - \hat{y}_i \right)^2\)</span></p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Use the LinearRegressionOutput as the final output layer of a net.</p>
</div>
<p>By default, gradients of this loss function are scaled by factor <cite>1/n</cite>, where n is the number of training examples.
The parameter <cite>grad_scale</cite> can be used to change this scale to <cite>grad_scale/n</cite>.</p>
<p>Defined in src/operator/regression_output.cc:L51</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the function.</li>
<li><strong>label</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input label to the function.</li>
<li><strong>grad_scale</strong> (<em>float, optional, default=1</em>) – Scale the gradient by a float factor</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.LogisticRegressionOutput">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">LogisticRegressionOutput</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>grad_scale=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.LogisticRegressionOutput" title="Permalink to this definition"></a></dt>
<dd><p>Applies a logistic function to the input.</p>
<p>The logistic function, also known as the sigmoid function, is computed as
<span class="math">\(\frac{1}{1+exp(-x)}\)</span>.</p>
<p>Commonly, the sigmoid is used to squash the real-valued output of a linear model
:math:wTx+b into the [0,1] range so that it can be interpreted as a probability.
It is suitable for binary classification or probability prediction tasks.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Use the LogisticRegressionOutput as the final output layer of a net.</p>
</div>
<p>By default, gradients of this loss function are scaled by factor <cite>1/n</cite>, where n is the number of training examples.
The parameter <cite>grad_scale</cite> can be used to change this scale to <cite>grad_scale/n</cite>.</p>
<p>Defined in src/operator/regression_output.cc:L93</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the function.</li>
<li><strong>label</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input label to the function.</li>
<li><strong>grad_scale</strong> (<em>float, optional, default=1</em>) – Scale the gradient by a float factor</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.MAERegressionOutput">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">MAERegressionOutput</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>grad_scale=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.MAERegressionOutput" title="Permalink to this definition"></a></dt>
<dd><p>Computes mean absolute error of the input.</p>
<p>MAE is a risk metric corresponding to the expected value of the absolute error.</p>
<p>If <span class="math">\(\hat{y}_i\)</span> is the predicted value of the i-th sample, and <span class="math">\(y_i\)</span> is the corresponding target value,
then the mean absolute error (MAE) estimated over <span class="math">\(n\)</span> samples is defined as</p>
<p><span class="math">\(\text{MAE}(y, \hat{y} ) = \frac{1}{n} \sum_{i=0}^{n-1} \left| y_i - \hat{y}_i \right|\)</span></p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Use the MAERegressionOutput as the final output layer of a net.</p>
</div>
<p>By default, gradients of this loss function are scaled by factor <cite>1/n</cite>, where n is the number of training examples.
The parameter <cite>grad_scale</cite> can be used to change this scale to <cite>grad_scale/n</cite>.</p>
<p>Defined in src/operator/regression_output.cc:L72</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the function.</li>
<li><strong>label</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input label to the function.</li>
<li><strong>grad_scale</strong> (<em>float, optional, default=1</em>) – Scale the gradient by a float factor</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.MakeLoss">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">MakeLoss</code><span class="sig-paren">(</span><em>data=None</em>, <em>grad_scale=_Null</em>, <em>valid_thresh=_Null</em>, <em>normalization=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.MakeLoss" title="Permalink to this definition"></a></dt>
<dd><p>Make your own loss function in network construction.</p>
<p>This operator accepts a customized loss function symbol as a terminal loss and
the symbol should be an operator with no backward dependency.
The output of this function is the gradient of loss with respect to the input data.</p>
<p>For example, if you are a making a cross entropy loss function. Assume <code class="docutils literal"><span class="pre">out</span></code> is the
predicted output and <code class="docutils literal"><span class="pre">label</span></code> is the true label, then the cross entropy can be defined as:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">cross_entropy</span> <span class="o">=</span> <span class="n">label</span> <span class="o">*</span> <span class="n">log</span><span class="p">(</span><span class="n">out</span><span class="p">)</span> <span class="o">+</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">label</span><span class="p">)</span> <span class="o">*</span> <span class="n">log</span><span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">out</span><span class="p">)</span>
<span class="n">loss</span> <span class="o">=</span> <span class="n">MakeLoss</span><span class="p">(</span><span class="n">cross_entropy</span><span class="p">)</span>
</pre></div>
</div>
<p>We will need to use <code class="docutils literal"><span class="pre">MakeLoss</span></code> when we are creating our own loss function or we want to
combine multiple loss functions. Also we may want to stop some variables’ gradients
from backpropagation. See more detail in <code class="docutils literal"><span class="pre">BlockGrad</span></code> or <code class="docutils literal"><span class="pre">stop_gradient</span></code>.</p>
<p>In addition, we can give a scale to the loss by setting <code class="docutils literal"><span class="pre">grad_scale</span></code>,
so that the gradient of the loss will be rescaled in the backpropagation.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This operator should be used as a Symbol instead of NDArray.</p>
</div>
<p>Defined in src/operator/make_loss.cc:L52</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>grad_scale</strong> (<em>float, optional, default=1</em>) – Gradient scale as a supplement to unary and binary operators</li>
<li><strong>valid_thresh</strong> (<em>float, optional, default=0</em>) – clip each element in the array to 0 when it is less than <code class="docutils literal"><span class="pre">valid_thresh</span></code>. This is used when <code class="docutils literal"><span class="pre">normalization</span></code> is set to <code class="docutils literal"><span class="pre">'valid'</span></code>.</li>
<li><strong>normalization</strong> (<em>{'batch', 'null', 'valid'},optional, default='null'</em>) – If this is set to null, the output gradient will not be normalized. If this is set to batch, the output gradient will be divided by the batch size. If this is set to valid, the output gradient will be divided by the number of valid input elements.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Pad">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Pad</code><span class="sig-paren">(</span><em>data=None</em>, <em>mode=_Null</em>, <em>pad_width=_Null</em>, <em>constant_value=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Pad" title="Permalink to this definition"></a></dt>
<dd><p>Pads an input array with a constant or edge values of the array.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>Pad</cite> is deprecated. Use <cite>pad</cite> instead.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Current implementation only supports 4D and 5D input arrays with padding applied
only on axes 1, 2 and 3. Expects axes 4 and 5 in <cite>pad_width</cite> to be zero.</p>
</div>
<p>This operation pads an input array with either a <cite>constant_value</cite> or edge values
along each axis of the input array. The amount of padding is specified by <cite>pad_width</cite>.</p>
<p><cite>pad_width</cite> is a tuple of integer padding widths for each axis of the format
<code class="docutils literal"><span class="pre">(before_1,</span> <span class="pre">after_1,</span> <span class="pre">...</span> <span class="pre">,</span> <span class="pre">before_N,</span> <span class="pre">after_N)</span></code>. The <cite>pad_width</cite> should be of length <code class="docutils literal"><span class="pre">2*N</span></code>
where <code class="docutils literal"><span class="pre">N</span></code> is the number of dimensions of the array.</p>
<p>For dimension <code class="docutils literal"><span class="pre">N</span></code> of the input array, <code class="docutils literal"><span class="pre">before_N</span></code> and <code class="docutils literal"><span class="pre">after_N</span></code> indicates how many values
to add before and after the elements of the array along dimension <code class="docutils literal"><span class="pre">N</span></code>.
The widths of the higher two dimensions <code class="docutils literal"><span class="pre">before_1</span></code>, <code class="docutils literal"><span class="pre">after_1</span></code>, <code class="docutils literal"><span class="pre">before_2</span></code>,
<code class="docutils literal"><span class="pre">after_2</span></code> must be 0.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[[ 1. 2. 3.]
[ 4. 5. 6.]]
[[ 7. 8. 9.]
[ 10. 11. 12.]]]
[[[ 11. 12. 13.]
[ 14. 15. 16.]]
[[ 17. 18. 19.]
[ 20. 21. 22.]]]]
pad(x,mode="edge", pad_width=(0,0,0,0,1,1,1,1)) =
[[[[ 1. 1. 2. 3. 3.]
[ 1. 1. 2. 3. 3.]
[ 4. 4. 5. 6. 6.]
[ 4. 4. 5. 6. 6.]]
[[ 7. 7. 8. 9. 9.]
[ 7. 7. 8. 9. 9.]
[ 10. 10. 11. 12. 12.]
[ 10. 10. 11. 12. 12.]]]
[[[ 11. 11. 12. 13. 13.]
[ 11. 11. 12. 13. 13.]
[ 14. 14. 15. 16. 16.]
[ 14. 14. 15. 16. 16.]]
[[ 17. 17. 18. 19. 19.]
[ 17. 17. 18. 19. 19.]
[ 20. 20. 21. 22. 22.]
[ 20. 20. 21. 22. 22.]]]]
pad(x, mode="constant", constant_value=0, pad_width=(0,0,0,0,1,1,1,1)) =
[[[[ 0. 0. 0. 0. 0.]
[ 0. 1. 2. 3. 0.]
[ 0. 4. 5. 6. 0.]
[ 0. 0. 0. 0. 0.]]
[[ 0. 0. 0. 0. 0.]
[ 0. 7. 8. 9. 0.]
[ 0. 10. 11. 12. 0.]
[ 0. 0. 0. 0. 0.]]]
[[[ 0. 0. 0. 0. 0.]
[ 0. 11. 12. 13. 0.]
[ 0. 14. 15. 16. 0.]
[ 0. 0. 0. 0. 0.]]
[[ 0. 0. 0. 0. 0.]
[ 0. 17. 18. 19. 0.]
[ 0. 20. 21. 22. 0.]
[ 0. 0. 0. 0. 0.]]]]
</pre></div>
</div>
<p>Defined in src/operator/pad.cc:L728</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – An n-dimensional input array.</li>
<li><strong>mode</strong> (<em>{'constant', 'edge', 'reflect'}, required</em>) – Padding type to use. “constant” pads with <cite>constant_value</cite> “edge” pads using the edge values of the input array “reflect” pads by reflecting values with respect to the edges.</li>
<li><strong>pad_width</strong> (<em>Shape(tuple), required</em>) – Widths of the padding regions applied to the edges of each axis. It is a tuple of integer padding widths for each axis of the format <code class="docutils literal"><span class="pre">(before_1,</span> <span class="pre">after_1,</span> <span class="pre">...</span> <span class="pre">,</span> <span class="pre">before_N,</span> <span class="pre">after_N)</span></code>. It should be of length <code class="docutils literal"><span class="pre">2*N</span></code> where <code class="docutils literal"><span class="pre">N</span></code> is the number of dimensions of the array.This is equivalent to pad_width in numpy.pad, but flattened.</li>
<li><strong>constant_value</strong> (<em>double, optional, default=0</em>) – The value used for padding when <cite>mode</cite> is “constant”.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Pooling">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Pooling</code><span class="sig-paren">(</span><em>data=None</em>, <em>global_pool=_Null</em>, <em>cudnn_off=_Null</em>, <em>kernel=_Null</em>, <em>pool_type=_Null</em>, <em>pooling_convention=_Null</em>, <em>stride=_Null</em>, <em>pad=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Pooling" title="Permalink to this definition"></a></dt>
<dd><p>Performs pooling on the input.</p>
<p>The shapes for 1-D pooling are</p>
<ul class="simple">
<li><strong>data</strong>: <em>(batch_size, channel, width)</em>,</li>
<li><strong>out</strong>: <em>(batch_size, num_filter, out_width)</em>.</li>
</ul>
<p>The shapes for 2-D pooling are</p>
<ul>
<li><p class="first"><strong>data</strong>: <em>(batch_size, channel, height, width)</em></p>
</li>
<li><p class="first"><strong>out</strong>: <em>(batch_size, num_filter, out_height, out_width)</em>, with:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">out_height</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">height</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">out_width</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
</pre></div>
</div>
</li>
</ul>
<p>The definition of <em>f</em> depends on <code class="docutils literal"><span class="pre">pooling_convention</span></code>, which has two options:</p>
<ul>
<li><p class="first"><strong>valid</strong> (default):</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span> <span class="o">=</span> <span class="n">floor</span><span class="p">((</span><span class="n">x</span><span class="o">+</span><span class="mi">2</span><span class="o">*</span><span class="n">p</span><span class="o">-</span><span class="n">k</span><span class="p">)</span><span class="o">/</span><span class="n">s</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span>
</pre></div>
</div>
</li>
<li><p class="first"><strong>full</strong>, which is compatible with Caffe:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span> <span class="o">=</span> <span class="n">ceil</span><span class="p">((</span><span class="n">x</span><span class="o">+</span><span class="mi">2</span><span class="o">*</span><span class="n">p</span><span class="o">-</span><span class="n">k</span><span class="p">)</span><span class="o">/</span><span class="n">s</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span>
</pre></div>
</div>
</li>
</ul>
<p>But <code class="docutils literal"><span class="pre">global_pool</span></code> is set to be true, then do a global pooling, namely reset
<code class="docutils literal"><span class="pre">kernel=(height,</span> <span class="pre">width)</span></code>.</p>
<p>Three pooling options are supported by <code class="docutils literal"><span class="pre">pool_type</span></code>:</p>
<ul class="simple">
<li><strong>avg</strong>: average pooling</li>
<li><strong>max</strong>: max pooling</li>
<li><strong>sum</strong>: sum pooling</li>
</ul>
<p>For 3-D pooling, an additional <em>depth</em> dimension is added before
<em>height</em>. Namely the input data will have shape <em>(batch_size, channel, depth,
height, width)</em>.</p>
<p>Defined in src/operator/pooling.cc:L121</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the pooling operator.</li>
<li><strong>global_pool</strong> (<em>boolean, optional, default=False</em>) – Ignore kernel size, do global pooling based on current input feature map.</li>
<li><strong>cudnn_off</strong> (<em>boolean, optional, default=False</em>) – Turn off cudnn pooling and use MXNet pooling operator.</li>
<li><strong>kernel</strong> (<em>Shape(tuple), required</em>) – pooling kernel size: (y, x) or (d, y, x)</li>
<li><strong>pool_type</strong> (<em>{'avg', 'max', 'sum'}, required</em>) – Pooling type to be applied.</li>
<li><strong>pooling_convention</strong> (<em>{'full', 'valid'},optional, default='valid'</em>) – Pooling convention to be applied.</li>
<li><strong>stride</strong> (<em>Shape(tuple), optional, default=()</em>) – stride: for pooling (y, x) or (d, y, x)</li>
<li><strong>pad</strong> (<em>Shape(tuple), optional, default=()</em>) – pad for pooling: (y, x) or (d, y, x)</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Pooling_v1">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Pooling_v1</code><span class="sig-paren">(</span><em>data=None</em>, <em>global_pool=_Null</em>, <em>kernel=_Null</em>, <em>pool_type=_Null</em>, <em>pooling_convention=_Null</em>, <em>stride=_Null</em>, <em>pad=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Pooling_v1" title="Permalink to this definition"></a></dt>
<dd><p>This operator is DEPRECATED.
Perform pooling on the input.</p>
<p>The shapes for 2-D pooling is</p>
<ul>
<li><p class="first"><strong>data</strong>: <em>(batch_size, channel, height, width)</em></p>
</li>
<li><p class="first"><strong>out</strong>: <em>(batch_size, num_filter, out_height, out_width)</em>, with:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">out_height</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">height</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
<span class="n">out_width</span> <span class="o">=</span> <span class="n">f</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
</pre></div>
</div>
</li>
</ul>
<p>The definition of <em>f</em> depends on <code class="docutils literal"><span class="pre">pooling_convention</span></code>, which has two options:</p>
<ul>
<li><p class="first"><strong>valid</strong> (default):</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span> <span class="o">=</span> <span class="n">floor</span><span class="p">((</span><span class="n">x</span><span class="o">+</span><span class="mi">2</span><span class="o">*</span><span class="n">p</span><span class="o">-</span><span class="n">k</span><span class="p">)</span><span class="o">/</span><span class="n">s</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span>
</pre></div>
</div>
</li>
<li><p class="first"><strong>full</strong>, which is compatible with Caffe:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">k</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span> <span class="o">=</span> <span class="n">ceil</span><span class="p">((</span><span class="n">x</span><span class="o">+</span><span class="mi">2</span><span class="o">*</span><span class="n">p</span><span class="o">-</span><span class="n">k</span><span class="p">)</span><span class="o">/</span><span class="n">s</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span>
</pre></div>
</div>
</li>
</ul>
<p>But <code class="docutils literal"><span class="pre">global_pool</span></code> is set to be true, then do a global pooling, namely reset
<code class="docutils literal"><span class="pre">kernel=(height,</span> <span class="pre">width)</span></code>.</p>
<p>Three pooling options are supported by <code class="docutils literal"><span class="pre">pool_type</span></code>:</p>
<ul class="simple">
<li><strong>avg</strong>: average pooling</li>
<li><strong>max</strong>: max pooling</li>
<li><strong>sum</strong>: sum pooling</li>
</ul>
<p>1-D pooling is special case of 2-D pooling with <em>weight=1</em> and
<em>kernel[1]=1</em>.</p>
<p>For 3-D pooling, an additional <em>depth</em> dimension is added before
<em>height</em>. Namely the input data will have shape <em>(batch_size, channel, depth,
height, width)</em>.</p>
<p>Defined in src/operator/pooling_v1.cc:L85</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the pooling operator.</li>
<li><strong>global_pool</strong> (<em>boolean, optional, default=False</em>) – Ignore kernel size, do global pooling based on current input feature map.</li>
<li><strong>kernel</strong> (<em>Shape(tuple), required</em>) – pooling kernel size: (y, x) or (d, y, x)</li>
<li><strong>pool_type</strong> (<em>{'avg', 'max', 'sum'}, required</em>) – Pooling type to be applied.</li>
<li><strong>pooling_convention</strong> (<em>{'full', 'valid'},optional, default='valid'</em>) – Pooling convention to be applied.</li>
<li><strong>stride</strong> (<em>Shape(tuple), optional, default=()</em>) – stride: for pooling (y, x) or (d, y, x)</li>
<li><strong>pad</strong> (<em>Shape(tuple), optional, default=()</em>) – pad for pooling: (y, x) or (d, y, x)</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.RNN">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">RNN</code><span class="sig-paren">(</span><em>data=None</em>, <em>parameters=None</em>, <em>state=None</em>, <em>state_cell=None</em>, <em>state_size=_Null</em>, <em>num_layers=_Null</em>, <em>bidirectional=_Null</em>, <em>mode=_Null</em>, <em>p=_Null</em>, <em>state_outputs=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.RNN" title="Permalink to this definition"></a></dt>
<dd><p>Applies a recurrent layer to input.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to RNN</li>
<li><strong>parameters</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Vector of all RNN trainable parameters concatenated</li>
<li><strong>state</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – initial hidden state of the RNN</li>
<li><strong>state_cell</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – initial cell state for LSTM networks (only for LSTM)</li>
<li><strong>state_size</strong> (<em>int (non-negative), required</em>) – size of the state for each layer</li>
<li><strong>num_layers</strong> (<em>int (non-negative), required</em>) – number of stacked layers</li>
<li><strong>bidirectional</strong> (<em>boolean, optional, default=False</em>) – whether to use bidirectional recurrent layers</li>
<li><strong>mode</strong> (<em>{'gru', 'lstm', 'rnn_relu', 'rnn_tanh'}, required</em>) – the type of RNN to compute</li>
<li><strong>p</strong> (<em>float, optional, default=0</em>) – Dropout probability, fraction of the input that gets dropped out at training time</li>
<li><strong>state_outputs</strong> (<em>boolean, optional, default=False</em>) – Whether to have the states as symbol outputs.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.ROIPooling">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">ROIPooling</code><span class="sig-paren">(</span><em>data=None</em>, <em>rois=None</em>, <em>pooled_size=_Null</em>, <em>spatial_scale=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.ROIPooling" title="Permalink to this definition"></a></dt>
<dd><p>Performs region of interest(ROI) pooling on the input array.</p>
<p>ROI pooling is a variant of a max pooling layer, in which the output size is fixed and
region of interest is a parameter. Its purpose is to perform max pooling on the inputs
of non-uniform sizes to obtain fixed-size feature maps. ROI pooling is a neural-net
layer mostly used in training a <cite>Fast R-CNN</cite> network for object detection.</p>
<p>This operator takes a 4D feature map as an input array and region proposals as <cite>rois</cite>,
then it pools over sub-regions of input and produces a fixed-sized output array
regardless of the ROI size.</p>
<p>To crop the feature map accordingly, you can resize the bounding box coordinates
by changing the parameters <cite>rois</cite> and <cite>spatial_scale</cite>.</p>
<p>The cropped feature maps are pooled by standard max pooling operation to a fixed size output
indicated by a <cite>pooled_size</cite> parameter. batch_size will change to the number of region
bounding boxes after <cite>ROIPooling</cite>.</p>
<p>The size of each region of interest doesn’t have to be perfectly divisible by
the number of pooling sections(<cite>pooled_size</cite>).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[[ 0., 1., 2., 3., 4., 5.],
[ 6., 7., 8., 9., 10., 11.],
[ 12., 13., 14., 15., 16., 17.],
[ 18., 19., 20., 21., 22., 23.],
[ 24., 25., 26., 27., 28., 29.],
[ 30., 31., 32., 33., 34., 35.],
[ 36., 37., 38., 39., 40., 41.],
[ 42., 43., 44., 45., 46., 47.]]]]
// region of interest i.e. bounding box coordinates.
y = [[0,0,0,4,4]]
// returns array of shape (2,2) according to the given roi with max pooling.
ROIPooling(x, y, (2,2), 1.0) = [[[[ 14., 16.],
[ 26., 28.]]]]
// region of interest is changed due to the change in `spacial_scale` parameter.
ROIPooling(x, y, (2,2), 0.7) = [[[[ 7., 9.],
[ 19., 21.]]]]
</pre></div>
</div>
<p>Defined in src/operator/roi_pooling.cc:L273</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array to the pooling operator, a 4D Feature maps</li>
<li><strong>rois</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Bounding box coordinates, a 2D array of [[batch_index, x1, y1, x2, y2]], where (x1, y1) and (x2, y2) are top left and bottom right corners of designated region of interest. <cite>batch_index</cite> indicates the index of corresponding image in the input array</li>
<li><strong>pooled_size</strong> (<em>Shape(tuple), required</em>) – ROI pooling output shape (h,w)</li>
<li><strong>spatial_scale</strong> (<em>float, required</em>) – Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layers</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Reshape">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Reshape</code><span class="sig-paren">(</span><em>data=None</em>, <em>shape=_Null</em>, <em>reverse=_Null</em>, <em>target_shape=_Null</em>, <em>keep_highest=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Reshape" title="Permalink to this definition"></a></dt>
<dd><p>Reshapes the input array.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">Reshape</span></code> is deprecated, use <code class="docutils literal"><span class="pre">reshape</span></code></p>
</div>
<p>Given an array and a shape, this function returns a copy of the array in the new shape.
The shape is a tuple of integers such as (2,3,4).The size of the new shape should be same as the size of the input array.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">reshape</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">]]</span>
</pre></div>
</div>
<p>Some dimensions of the shape can take special values from the set {0, -1, -2, -3, -4}. The significance of each is explained below:</p>
<ul>
<li><p class="first"><code class="docutils literal"><span class="pre">0</span></code> copy this dimension from the input to the output shape.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (4,0,2), output shape = (4,3,2)
- input shape = (2,3,4), shape = (2,0,0), output shape = (2,3,4)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-1</span></code> infers the dimension of the output shape by using the remainder of the input dimensions
keeping the size of the new array same as that of the input array.
At most one dimension of shape can be -1.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (6,1,-1), output shape = (6,1,4)
- input shape = (2,3,4), shape = (3,-1,8), output shape = (3,1,8)
- input shape = (2,3,4), shape=(-1,), output shape = (24,)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-2</span></code> copy all/remainder of the input dimensions to the output shape.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (-2,), output shape = (2,3,4)
- input shape = (2,3,4), shape = (2,-2), output shape = (2,3,4)
- input shape = (2,3,4), shape = (-2,1,1), output shape = (2,3,4,1,1)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-3</span></code> use the product of two consecutive dimensions of the input shape as the output dimension.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (-3,4), output shape = (6,4)
- input shape = (2,3,4,5), shape = (-3,-3), output shape = (6,20)
- input shape = (2,3,4), shape = (0,-3), output shape = (2,12)
- input shape = (2,3,4), shape = (-3,-2), output shape = (6,4)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-4</span></code> split one dimension of the input into two dimensions passed subsequent to -4 in shape (can contain -1).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (-4,1,2,-2), output shape =(1,2,3,4)
- input shape = (2,3,4), shape = (2,-4,-1,3,-2), output shape = (2,1,3,4)
</pre></div>
</div>
</li>
</ul>
<p>If the argument <cite>reverse</cite> is set to 1, then the special values are inferred from right to left.</p>
<blockquote>
<div><p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- without reverse=1, for input shape = (10,5,4), shape = (-1,0), output shape would be (40,5)
- with reverse=1, output shape will be (50,4).
</pre></div>
</div>
</div></blockquote>
<p>Defined in src/operator/tensor/matrix_op.cc:L87</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to reshape.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – The target shape</li>
<li><strong>reverse</strong> (<em>boolean, optional, default=False</em>) – If true then the special values are inferred from right to left</li>
<li><strong>target_shape</strong> (<em>Shape(tuple), optional, default=(0,0)</em>) – (Deprecated! Use <code class="docutils literal"><span class="pre">shape</span></code> instead.) Target new shape. One and only one dim can be 0, in which case it will be inferred from the rest of dims</li>
<li><strong>keep_highest</strong> (<em>boolean, optional, default=False</em>) – (Deprecated! Use <code class="docutils literal"><span class="pre">shape</span></code> instead.) Whether keep the highest dim unchanged.If set to true, then the first dim in target_shape is ignored,and always fixed as input</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<p>Reshapes the input array into a new shape.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(4L,)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(2L, 2L)</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 2.],</span>
<span class="go"> [ 3., 4.]], dtype=float32)</span>
</pre></div>
</div>
<p>You can use <code class="docutils literal"><span class="pre">0</span></code> to copy a particular dimension from the input to the output shape
and ‘-1’ to infer the dimensions of the output.</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">ones</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="mi">4</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">x</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(2L, 3L, 4L)</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">y</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(4L, 3L, 2L)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SVMOutput">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SVMOutput</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>margin=_Null</em>, <em>regularization_coefficient=_Null</em>, <em>use_linear=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SVMOutput" title="Permalink to this definition"></a></dt>
<dd><p>Computes support vector machine based transformation of the input.</p>
<p>This tutorial demonstrates using SVM as output layer for classification instead of softmax:
<a class="reference external" href="https://github.com/dmlc/mxnet/tree/master/example/svm_mnist">https://github.com/dmlc/mxnet/tree/master/example/svm_mnist</a>.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data for SVM transformation.</li>
<li><strong>label</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Class label for the input data.</li>
<li><strong>margin</strong> (<em>float, optional, default=1</em>) – The loss function penalizes outputs that lie outside this margin. Default margin is 1.</li>
<li><strong>regularization_coefficient</strong> (<em>float, optional, default=1</em>) – Regularization parameter for the SVM. This balances the tradeoff between coefficient size and error.</li>
<li><strong>use_linear</strong> (<em>boolean, optional, default=False</em>) – Whether to use L1-SVM objective. L2-SVM objective is used by default.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SequenceLast">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SequenceLast</code><span class="sig-paren">(</span><em>data=None</em>, <em>sequence_length=None</em>, <em>use_sequence_length=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SequenceLast" title="Permalink to this definition"></a></dt>
<dd><p>Takes the last element of a sequence.</p>
<p>This function takes an n-dimensional input array of the form
[max_sequence_length, batch_size, other_feature_dims] and returns a (n-1)-dimensional array
of the form [batch_size, other_feature_dims].</p>
<p>Parameter <cite>sequence_length</cite> is used to handle variable-length sequences. <cite>sequence_length</cite> should be
an input array of positive ints of dimension [batch_size]. To use this parameter,
set <cite>use_sequence_length</cite> to <cite>True</cite>, otherwise each example in the batch is assumed
to have the max sequence length.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Alternatively, you can also use <cite>take</cite> operator.</p>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[ 1., 2., 3.],
[ 4., 5., 6.],
[ 7., 8., 9.]],
[[ 10., 11., 12.],
[ 13., 14., 15.],
[ 16., 17., 18.]],
[[ 19., 20., 21.],
[ 22., 23., 24.],
[ 25., 26., 27.]]]
// returns last sequence when sequence_length parameter is not used
SequenceLast(x) = [[ 19., 20., 21.],
[ 22., 23., 24.],
[ 25., 26., 27.]]
// sequence_length y is used
SequenceLast(x, y=[1,1,1], use_sequence_length=True) =
[[ 1., 2., 3.],
[ 4., 5., 6.],
[ 7., 8., 9.]]
// sequence_length y is used
SequenceLast(x, y=[1,2,3], use_sequence_length=True) =
[[ 1., 2., 3.],
[ 13., 14., 15.],
[ 25., 26., 27.]]
</pre></div>
</div>
<p>Defined in src/operator/sequence_last.cc:L77</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – n-dimensional input array of the form [max_sequence_length, batch_size, other_feature_dims] where n>2</li>
<li><strong>sequence_length</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – vector of sequence lengths of the form [batch_size]</li>
<li><strong>use_sequence_length</strong> (<em>boolean, optional, default=False</em>) – If set to true, this layer takes in an extra input parameter <cite>sequence_length</cite> to specify variable length sequence</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SequenceMask">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SequenceMask</code><span class="sig-paren">(</span><em>data=None</em>, <em>sequence_length=None</em>, <em>use_sequence_length=_Null</em>, <em>value=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SequenceMask" title="Permalink to this definition"></a></dt>
<dd><p>Sets all elements outside the sequence to a constant value.</p>
<p>This function takes an n-dimensional input array of the form
[max_sequence_length, batch_size, other_feature_dims] and returns an array of the same shape.</p>
<p>Parameter <cite>sequence_length</cite> is used to handle variable-length sequences. <cite>sequence_length</cite>
should be an input array of positive ints of dimension [batch_size].
To use this parameter, set <cite>use_sequence_length</cite> to <cite>True</cite>,
otherwise each example in the batch is assumed to have the max sequence length and
this operator works as the <cite>identity</cite> operator.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// Batch 1
B1 = [[ 1., 2., 3.],
[ 7., 8., 9.],
[ 13., 14., 15.]]
// Batch 2
B2 = [[ 4., 5., 6.],
[ 10., 11., 12.],
[ 16., 17., 18.]]
// works as identity operator when sequence_length parameter is not used
SequenceMask(x) = [[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// sequence_length [1,1] means 1 of each batch will be kept
// and other rows are masked with default mask value = 0
SequenceMask(x, y=[1,1], use_sequence_length=True) =
[[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]],
[[ 0., 0., 0.],
[ 0., 0., 0.]]]
// sequence_length [2,3] means 2 of batch B1 and 3 of batch B2 will be kept
// and other rows are masked with value = 1
SequenceMask(x, y=[2,3], use_sequence_length=True, value=1) =
[[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 1., 1., 1.],
[ 16., 17., 18.]]]
</pre></div>
</div>
<p>Defined in src/operator/sequence_mask.cc:L112</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – n-dimensional input array of the form [max_sequence_length, batch_size, other_feature_dims] where n>2</li>
<li><strong>sequence_length</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – vector of sequence lengths of the form [batch_size]</li>
<li><strong>use_sequence_length</strong> (<em>boolean, optional, default=False</em>) – If set to true, this layer takes in an extra input parameter <cite>sequence_length</cite> to specify variable length sequence</li>
<li><strong>value</strong> (<em>float, optional, default=0</em>) – The value to be used as a mask.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SequenceReverse">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SequenceReverse</code><span class="sig-paren">(</span><em>data=None</em>, <em>sequence_length=None</em>, <em>use_sequence_length=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SequenceReverse" title="Permalink to this definition"></a></dt>
<dd><p>Reverses the elements of each sequence.</p>
<p>This function takes an n-dimensional input array of the form [max_sequence_length, batch_size, other_feature_dims]
and returns an array of the same shape.</p>
<p>Parameter <cite>sequence_length</cite> is used to handle variable-length sequences.
<cite>sequence_length</cite> should be an input array of positive ints of dimension [batch_size].
To use this parameter, set <cite>use_sequence_length</cite> to <cite>True</cite>,
otherwise each example in the batch is assumed to have the max sequence length.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// Batch 1
B1 = [[ 1., 2., 3.],
[ 7., 8., 9.],
[ 13., 14., 15.]]
// Batch 2
B2 = [[ 4., 5., 6.],
[ 10., 11., 12.],
[ 16., 17., 18.]]
// returns reverse sequence when sequence_length parameter is not used
SequenceReverse(x) = [[[ 13., 14., 15.],
[ 16., 17., 18.]],
[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 1., 2., 3.],
[ 4., 5., 6.]]]
// sequence_length [2,2] means 2 rows of
// both batch B1 and B2 will be reversed.
SequenceReverse(x, y=[2,2], use_sequence_length=True) =
[[[ 7., 8., 9.],
[ 10., 11., 12.]],
[[ 1., 2., 3.],
[ 4., 5., 6.]],
[[ 13., 14., 15.],
[ 16., 17., 18.]]]
// sequence_length [2,3] means 2 of batch B2 and 3 of batch B3
// will be reversed.
SequenceReverse(x, y=[2,3], use_sequence_length=True) =
[[[ 7., 8., 9.],
[ 16., 17., 18.]],
[[ 1., 2., 3.],
[ 10., 11., 12.]],
[[ 13., 14, 15.],
[ 4., 5., 6.]]]
</pre></div>
</div>
<p>Defined in src/operator/sequence_reverse.cc:L98</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – n-dimensional input array of the form [max_sequence_length, batch_size, other dims] where n>2</li>
<li><strong>sequence_length</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – vector of sequence lengths of the form [batch_size]</li>
<li><strong>use_sequence_length</strong> (<em>boolean, optional, default=False</em>) – If set to true, this layer takes in an extra input parameter <cite>sequence_length</cite> to specify variable length sequence</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SliceChannel">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SliceChannel</code><span class="sig-paren">(</span><em>data=None</em>, <em>num_outputs=_Null</em>, <em>axis=_Null</em>, <em>squeeze_axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SliceChannel" title="Permalink to this definition"></a></dt>
<dd><p>Splits an array along a particular axis into multiple sub-arrays.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">SliceChannel</span></code> is deprecated. Use <code class="docutils literal"><span class="pre">split</span></code> instead.</p>
</div>
<p><strong>Note</strong> that <cite>num_outputs</cite> should evenly divide the length of the axis
along which to split the array.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[ 1.]
[ 2.]]
[[ 3.]
[ 4.]]
[[ 5.]
[ 6.]]]
x.shape = (3, 2, 1)
y = split(x, axis=1, num_outputs=2) // a list of 2 arrays with shape (3, 1, 1)
y = [[[ 1.]]
[[ 3.]]
[[ 5.]]]
[[[ 2.]]
[[ 4.]]
[[ 6.]]]
y[0].shape = (3, 1, 1)
z = split(x, axis=0, num_outputs=3) // a list of 3 arrays with shape (1, 2, 1)
z = [[[ 1.]
[ 2.]]]
[[[ 3.]
[ 4.]]]
[[[ 5.]
[ 6.]]]
z[0].shape = (1, 2, 1)
</pre></div>
</div>
<p><cite>squeeze_axis=1</cite> removes the axis with length 1 from the shapes of the output arrays.
<strong>Note</strong> that setting <cite>squeeze_axis</cite> to <code class="docutils literal"><span class="pre">1</span></code> removes axis with length 1 only
along the <cite>axis</cite> which it is split.
Also <cite>squeeze_axis</cite> can be set to true only if <code class="docutils literal"><span class="pre">input.shape[axis]</span> <span class="pre">==</span> <span class="pre">num_outputs</span></code>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>z = split(x, axis=0, num_outputs=3, squeeze_axis=1) // a list of 3 arrays with shape (2, 1)
z = [[ 1.]
[ 2.]]
[[ 3.]
[ 4.]]
[[ 5.]
[ 6.]]
z[0].shape = (2 ,1 )
</pre></div>
</div>
<p>Defined in src/operator/slice_channel.cc:L88</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>num_outputs</strong> (<em>int, required</em>) – Number of splits. Note that this should evenly divide the length of the <cite>axis</cite>.</li>
<li><strong>axis</strong> (<em>int, optional, default='1'</em>) – Axis along which to split.</li>
<li><strong>squeeze_axis</strong> (<em>boolean, optional, default=False</em>) – If true, Removes the axis with length 1 from the shapes of the output arrays. <strong>Note</strong> that setting <cite>squeeze_axis</cite> to <code class="docutils literal"><span class="pre">true</span></code> removes axis with length 1 only along the <cite>axis</cite> which it is split. Also <cite>squeeze_axis</cite> can be set to <code class="docutils literal"><span class="pre">true</span></code> only if <code class="docutils literal"><span class="pre">input.shape[axis]</span> <span class="pre">==</span> <span class="pre">num_outputs</span></code>.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.Softmax">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">Softmax</code><span class="sig-paren">(</span><em>data=None</em>, <em>grad_scale=_Null</em>, <em>ignore_label=_Null</em>, <em>multi_output=_Null</em>, <em>use_ignore=_Null</em>, <em>preserve_shape=_Null</em>, <em>normalization=_Null</em>, <em>out_grad=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.Softmax" title="Permalink to this definition"></a></dt>
<dd><p>Please use <cite>SoftmaxOutput</cite>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This operator has been renamed to <cite>SoftmaxOutput</cite>, which
computes the gradient of cross-entropy loss w.r.t softmax output.
To just compute softmax output, use the <cite>softmax</cite> operator.</p>
</div>
<p>Defined in src/operator/softmax_output.cc:L123</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>grad_scale</strong> (<em>float, optional, default=1</em>) – Scales the gradient by a float factor.</li>
<li><strong>ignore_label</strong> (<em>float, optional, default=-1</em>) – The instances whose <cite>labels</cite> == <cite>ignore_label</cite> will be ignored during backward, if <cite>use_ignore</cite> is set to <code class="docutils literal"><span class="pre">true</span></code>).</li>
<li><strong>multi_output</strong> (<em>boolean, optional, default=False</em>) – If set to <code class="docutils literal"><span class="pre">true</span></code>, the softmax function will be computed along axis <code class="docutils literal"><span class="pre">1</span></code>. This is applied when the shape of input array differs from the shape of label array.</li>
<li><strong>use_ignore</strong> (<em>boolean, optional, default=False</em>) – If set to <code class="docutils literal"><span class="pre">true</span></code>, the <cite>ignore_label</cite> value will not contribute to the backward gradient.</li>
<li><strong>preserve_shape</strong> (<em>boolean, optional, default=False</em>) – If set to <code class="docutils literal"><span class="pre">true</span></code>, the softmax function will be computed along the last axis (<code class="docutils literal"><span class="pre">-1</span></code>).</li>
<li><strong>normalization</strong> (<em>{'batch', 'null', 'valid'},optional, default='null'</em>) – Normalizes the gradient.</li>
<li><strong>out_grad</strong> (<em>boolean, optional, default=False</em>) – Multiplies gradient with output gradient element-wise.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SoftmaxActivation">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SoftmaxActivation</code><span class="sig-paren">(</span><em>data=None</em>, <em>mode=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SoftmaxActivation" title="Permalink to this definition"></a></dt>
<dd><p>Applies softmax activation to input. This is intended for internal layers.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">This operator has been deprecated, please use <cite>softmax</cite>.</p>
</div>
<p>If <cite>mode</cite> = <code class="docutils literal"><span class="pre">instance</span></code>, this operator will compute a softmax for each instance in the batch.
This is the default mode.</p>
<p>If <cite>mode</cite> = <code class="docutils literal"><span class="pre">channel</span></code>, this operator will compute a k-class softmax at each position
of each instance, where <cite>k</cite> = <code class="docutils literal"><span class="pre">num_channel</span></code>. This mode can only be used when the input array
has at least 3 dimensions.
This can be used for <cite>fully convolutional network</cite>, <cite>image segmentation</cite>, etc.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">input_array</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="mf">3.</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="o">-</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">],</span>
<span class="gp">>>> </span> <span class="p">[</span><span class="mf">2.</span><span class="p">,</span> <span class="o">-.</span><span class="mi">4</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">]])</span>
<span class="gp">>>> </span><span class="n">softmax_act</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">SoftmaxActivation</span><span class="p">(</span><span class="n">input_array</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span> <span class="n">softmax_act</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">[[ 1.78322066e-02 1.46375655e-03 5.38485940e-04 6.56010211e-03 9.73605454e-01]</span>
<span class="go"> [ 6.56221947e-03 5.95310994e-04 9.73919690e-01 1.78379621e-02 1.08472735e-03]]</span>
</pre></div>
</div>
<p>Defined in src/operator/softmax_activation.cc:L48</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array to activation function.</li>
<li><strong>mode</strong> (<em>{'channel', 'instance'},optional, default='instance'</em>) – Specifies how to compute the softmax. If set to <code class="docutils literal"><span class="pre">instance</span></code>, it computes softmax for each instance. If set to <code class="docutils literal"><span class="pre">channel</span></code>, It computes cross channel softmax for each position of each instance.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SoftmaxOutput">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SoftmaxOutput</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>grad_scale=_Null</em>, <em>ignore_label=_Null</em>, <em>multi_output=_Null</em>, <em>use_ignore=_Null</em>, <em>preserve_shape=_Null</em>, <em>normalization=_Null</em>, <em>out_grad=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SoftmaxOutput" title="Permalink to this definition"></a></dt>
<dd><p>Computes the gradient of cross entropy loss with respect to softmax output.</p>
<ul>
<li><p class="first">This operator computes the gradient in two steps.
The cross entropy loss does not actually need to be computed.</p>
<ul class="simple">
<li>Applies softmax function on the input array.</li>
<li>Computes and returns the gradient of cross entropy loss w.r.t. the softmax output.</li>
</ul>
</li>
<li><p class="first">The softmax function, cross entropy loss and gradient is given by:</p>
<ul>
<li><p class="first">Softmax Function:</p>
<div class="math">
\[\text{softmax}(x)_i = \frac{exp(x_i)}{\sum_j exp(x_j)}\]</div>
</li>
<li><p class="first">Cross Entropy Function:</p>
<div class="math">
\[\text{CE(label, output)} = - \sum_i \text{label}_i \log(\text{output}_i)\]</div>
</li>
<li><p class="first">The gradient of cross entropy loss w.r.t softmax output:</p>
<div class="math">
\[\text{gradient} = \text{output} - \text{label}\]</div>
</li>
</ul>
</li>
<li><p class="first">During forward propagation, the softmax function is computed for each instance in the input array.</p>
<p>For general <em>N</em>-D input arrays with shape <span class="math">\((d_1, d_2, ..., d_n)\)</span>. The size is
<span class="math">\(s=d_1 \cdot d_2 \cdot \cdot \cdot d_n\)</span>. We can use the parameters <cite>preserve_shape</cite>
and <cite>multi_output</cite> to specify the way to compute softmax:</p>
<ul class="simple">
<li>By default, <cite>preserve_shape</cite> is <code class="docutils literal"><span class="pre">false</span></code>. This operator will reshape the input array
into a 2-D array with shape <span class="math">\((d_1, \frac{s}{d_1})\)</span> and then compute the softmax function for
each row in the reshaped array, and afterwards reshape it back to the original shape
<span class="math">\((d_1, d_2, ..., d_n)\)</span>.</li>
<li>If <cite>preserve_shape</cite> is <code class="docutils literal"><span class="pre">true</span></code>, the softmax function will be computed along
the last axis (<cite>axis</cite> = <code class="docutils literal"><span class="pre">-1</span></code>).</li>
<li>If <cite>multi_output</cite> is <code class="docutils literal"><span class="pre">true</span></code>, the softmax function will be computed along
the second axis (<cite>axis</cite> = <code class="docutils literal"><span class="pre">1</span></code>).</li>
</ul>
</li>
<li><p class="first">During backward propagation, the gradient of cross-entropy loss w.r.t softmax output array is computed.
The provided label can be a one-hot label array or a probability label array.</p>
<ul>
<li><p class="first">If the parameter <cite>use_ignore</cite> is <code class="docutils literal"><span class="pre">true</span></code>, <cite>ignore_label</cite> can specify input instances
with a particular label to be ignored during backward propagation. <strong>This has no effect when
softmax `output` has same shape as `label`</strong>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>data = [[1,2,3,4],[2,2,2,2],[3,3,3,3],[4,4,4,4]]
label = [1,0,2,3]
ignore_label = 1
SoftmaxOutput(data=data, label = label,\
multi_output=true, use_ignore=true,\
ignore_label=ignore_label)
## forward softmax output
[[ 0.0320586 0.08714432 0.23688284 0.64391428]
[ 0.25 0.25 0.25 0.25 ]
[ 0.25 0.25 0.25 0.25 ]
[ 0.25 0.25 0.25 0.25 ]]
## backward gradient output
[[ 0. 0. 0. 0. ]
[-0.75 0.25 0.25 0.25]
[ 0.25 0.25 -0.75 0.25]
[ 0.25 0.25 0.25 -0.75]]
## notice that the first row is all 0 because label[0] is 1, which is equal to ignore_label.
</pre></div>
</div>
</li>
<li><p class="first">The parameter <cite>grad_scale</cite> can be used to rescale the gradient, which is often used to
give each loss function different weights.</p>
</li>
<li><p class="first">This operator also supports various ways to normalize the gradient by <cite>normalization</cite>,
The <cite>normalization</cite> is applied if softmax output has different shape than the labels.
The <cite>normalization</cite> mode can be set to the followings:</p>
<ul class="simple">
<li><code class="docutils literal"><span class="pre">'null'</span></code>: do nothing.</li>
<li><code class="docutils literal"><span class="pre">'batch'</span></code>: divide the gradient by the batch size.</li>
<li><code class="docutils literal"><span class="pre">'valid'</span></code>: divide the gradient by the number of instances which are not ignored.</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Defined in src/operator/softmax_output.cc:L108</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>label</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Ground truth label.</li>
<li><strong>grad_scale</strong> (<em>float, optional, default=1</em>) – Scales the gradient by a float factor.</li>
<li><strong>ignore_label</strong> (<em>float, optional, default=-1</em>) – The instances whose <cite>labels</cite> == <cite>ignore_label</cite> will be ignored during backward, if <cite>use_ignore</cite> is set to <code class="docutils literal"><span class="pre">true</span></code>).</li>
<li><strong>multi_output</strong> (<em>boolean, optional, default=False</em>) – If set to <code class="docutils literal"><span class="pre">true</span></code>, the softmax function will be computed along axis <code class="docutils literal"><span class="pre">1</span></code>. This is applied when the shape of input array differs from the shape of label array.</li>
<li><strong>use_ignore</strong> (<em>boolean, optional, default=False</em>) – If set to <code class="docutils literal"><span class="pre">true</span></code>, the <cite>ignore_label</cite> value will not contribute to the backward gradient.</li>
<li><strong>preserve_shape</strong> (<em>boolean, optional, default=False</em>) – If set to <code class="docutils literal"><span class="pre">true</span></code>, the softmax function will be computed along the last axis (<code class="docutils literal"><span class="pre">-1</span></code>).</li>
<li><strong>normalization</strong> (<em>{'batch', 'null', 'valid'},optional, default='null'</em>) – Normalizes the gradient.</li>
<li><strong>out_grad</strong> (<em>boolean, optional, default=False</em>) – Multiplies gradient with output gradient element-wise.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SpatialTransformer">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SpatialTransformer</code><span class="sig-paren">(</span><em>data=None</em>, <em>loc=None</em>, <em>target_shape=_Null</em>, <em>transform_type=_Null</em>, <em>sampler_type=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SpatialTransformer" title="Permalink to this definition"></a></dt>
<dd><p>Applies a spatial transformer to input feature map.</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the SpatialTransformerOp.</li>
<li><strong>loc</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – localisation net, the output dim should be 6 when transform_type is affine. You shold initialize the weight and bias with identity tranform.</li>
<li><strong>target_shape</strong> (<em>Shape(tuple), optional, default=(0,0)</em>) – output shape(h, w) of spatial transformer: (y, x)</li>
<li><strong>transform_type</strong> (<em>{'affine'}, required</em>) – transformation type</li>
<li><strong>sampler_type</strong> (<em>{'bilinear'}, required</em>) – sampling type</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.SwapAxis">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">SwapAxis</code><span class="sig-paren">(</span><em>data=None</em>, <em>dim1=_Null</em>, <em>dim2=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.SwapAxis" title="Permalink to this definition"></a></dt>
<dd><p>Interchanges two axes of an array.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span> x = [[1, 2, 3]])
swapaxes(x, 0, 1) = [[ 1],
[ 2],
[ 3]]
x = [[[ 0, 1],
[ 2, 3]],
[[ 4, 5],
[ 6, 7]]] // (2,2,2) array
swapaxes(x, 0, 2) = [[[ 0, 4],
[ 2, 6]],
[[ 1, 5],
[ 3, 7]]]
</pre></div>
</div>
<p>Defined in src/operator/swapaxis.cc:L55</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>dim1</strong> (<em>int (non-negative), optional, default=0</em>) – the first axis to be swapped.</li>
<li><strong>dim2</strong> (<em>int (non-negative), optional, default=0</em>) – the second axis to be swapped.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.UpSampling">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">UpSampling</code><span class="sig-paren">(</span><em>*data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.UpSampling" title="Permalink to this definition"></a></dt>
<dd><p>Performs nearest neighbor/bilinear up sampling to inputs.</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>data</strong> (<em>NDArray[]</em>) – Array of tensors to upsample</li>
<li><strong>scale</strong> (<em>int (non-negative), required</em>) – Up sampling scale</li>
<li><strong>num_filter</strong> (<em>int (non-negative), optional, default=0</em>) – Input filter. Only used by bilinear sample_type.</li>
<li><strong>sample_type</strong> (<em>{'bilinear', 'nearest'}, required</em>) – upsampling method</li>
<li><strong>multi_input_mode</strong> (<em>{'concat', 'sum'},optional, default='concat'</em>) – How to handle multiple input. concat means concatenate upsampled images along the channel dimension. sum means add all images together, only available for nearest neighbor upsampling.</li>
<li><strong>workspace</strong> (<em>long (non-negative), optional, default=512</em>) – Tmp workspace for deconvolution (MB)</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.abs">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">abs</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.abs" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise absolute value of the input.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">abs</span><span class="p">([</span><span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L218</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.adam_update">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">adam_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>mean=None</em>, <em>var=None</em>, <em>lr=_Null</em>, <em>beta1=_Null</em>, <em>beta2=_Null</em>, <em>epsilon=_Null</em>, <em>wd=_Null</em>, <em>rescale_grad=_Null</em>, <em>clip_gradient=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.adam_update" title="Permalink to this definition"></a></dt>
<dd><p>Update function for Adam optimizer. Adam is seen as a generalization
of AdaGrad.</p>
<p>Adam update consists of the following steps, where g represents gradient and m, v
are 1st and 2nd order moment estimates (mean and variance).</p>
<div class="math">
\[\begin{split}g_t = \nabla J(W_{t-1})\\
m_t = \beta_1 m_{t-1} + (1 - \beta_1) g_t\\
v_t = \beta_2 v_{t-1} + (1 - \beta_2) g_t^2\\
W_t = W_{t-1} - \alpha \frac{ m_t }{ \sqrt{ v_t } + \epsilon }\end{split}\]</div>
<p>It updates the weights using:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">m</span> <span class="o">=</span> <span class="n">beta1</span><span class="o">*</span><span class="n">m</span> <span class="o">+</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">beta1</span><span class="p">)</span><span class="o">*</span><span class="n">grad</span>
<span class="n">v</span> <span class="o">=</span> <span class="n">beta2</span><span class="o">*</span><span class="n">v</span> <span class="o">+</span> <span class="p">(</span><span class="mi">1</span><span class="o">-</span><span class="n">beta2</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">grad</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="n">w</span> <span class="o">+=</span> <span class="o">-</span> <span class="n">learning_rate</span> <span class="o">*</span> <span class="n">m</span> <span class="o">/</span> <span class="p">(</span><span class="n">sqrt</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="o">+</span> <span class="n">epsilon</span><span class="p">)</span>
</pre></div>
</div>
<p>Defined in src/operator/optimizer_op.cc:L126</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>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>mean</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Moving mean</li>
<li><strong>var</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Moving variance</li>
<li><strong>lr</strong> (<em>float, required</em>) – Learning rate</li>
<li><strong>beta1</strong> (<em>float, optional, default=0.9</em>) – The decay rate for the 1st moment estimates.</li>
<li><strong>beta2</strong> (<em>float, optional, default=0.999</em>) – The decay rate for the 2nd moment estimates.</li>
<li><strong>epsilon</strong> (<em>float, optional, default=1e-08</em>) – A small constant for numerical stability.</li>
<li><strong>wd</strong> (<em>float, optional, default=0</em>) – Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.</li>
<li><strong>rescale_grad</strong> (<em>float, optional, default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float, optional, default=-1</em>) – Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.add_n">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">add_n</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.add_n" title="Permalink to this definition"></a></dt>
<dd><p>Adds all input arguments element-wise.</p>
<div class="math">
\[add\_n(a_1, a_2, ..., a_n) = a_1 + a_2 + ... + a_n\]</div>
<p><code class="docutils literal"><span class="pre">add_n</span></code> is potentially more efficient than calling <code class="docutils literal"><span class="pre">add</span></code> by <cite>n</cite> times.</p>
<p>Defined in src/operator/tensor/elemwise_sum.cc:L63</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>args</strong> (<em>NDArray[]</em>) – Positional input arguments</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.arccos">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">arccos</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.arccos" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise inverse cosine of the input array.</p>
<p>The input should be in range <cite>[-1, 1]</cite>.
The output is in the closed interval <span class="math">\([0, \pi]\)</span></p>
<div class="math">
\[arccos([-1, -.707, 0, .707, 1]) = [\pi, 3\pi/4, \pi/2, \pi/4, 0]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L523</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.arccosh">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">arccosh</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.arccosh" title="Permalink to this definition"></a></dt>
<dd><p>Returns the element-wise inverse hyperbolic cosine of the input array, computed element-wise.</p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L629</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.arcsin">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">arcsin</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.arcsin" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise inverse sine of the input array.</p>
<p>The input should be in the range <cite>[-1, 1]</cite>.
The output is in the closed interval of [<span class="math">\(-\pi/2\)</span>, <span class="math">\(\pi/2\)</span>].</p>
<div class="math">
\[arcsin([-1, -.707, 0, .707, 1]) = [-\pi/2, -\pi/4, 0, \pi/4, \pi/2]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L506</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.arcsinh">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">arcsinh</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.arcsinh" title="Permalink to this definition"></a></dt>
<dd><p>Returns the element-wise inverse hyperbolic sine of the input array, computed element-wise.</p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L619</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.arctan">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">arctan</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.arctan" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise inverse tangent of the input array.</p>
<p>The output is in the closed interval <span class="math">\([-\pi/2, \pi/2]\)</span></p>
<div class="math">
\[arctan([-1, 0, 1]) = [-\pi/4, 0, \pi/4]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L539</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.arctanh">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">arctanh</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.arctanh" title="Permalink to this definition"></a></dt>
<dd><p>Returns the element-wise inverse hyperbolic tangent of the input array, computed element-wise.</p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L639</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.argmax">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">argmax</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.argmax" title="Permalink to this definition"></a></dt>
<dd><p>Returns indices of the maximum values along an axis.</p>
<p>In the case of multiple occurrences of maximum values, the indices corresponding to the first occurrence
are returned.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 0., 1., 2.],
[ 3., 4., 5.]]
// argmax along axis 0
argmax(x, axis=0) = [ 1., 1., 1.]
// argmax along axis 1
argmax(x, axis=1) = [ 2., 2.]
// argmax along axis 1 keeping same dims as an input array
argmax(x, axis=1, keepdims=True) = [[ 2.],
[ 2.]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_index.cc:L33</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>int or None, optional, default='None'</em>) – The axis along which to perform the reduction. Negative values means indexing from right to left. <code class="docutils literal"><span class="pre">Requires</span> <span class="pre">axis</span> <span class="pre">to</span> <span class="pre">be</span> <span class="pre">set</span> <span class="pre">as</span> <span class="pre">int,</span> <span class="pre">because</span> <span class="pre">global</span> <span class="pre">reduction</span> <span class="pre">is</span> <span class="pre">not</span> <span class="pre">supported</span> <span class="pre">yet.</span></code></li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axis is left in the result as dimension with size one.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.argmax_channel">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">argmax_channel</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.argmax_channel" title="Permalink to this definition"></a></dt>
<dd><p>Returns argmax indices of each channel from the input array.</p>
<p>The result will be an NDArray of shape (num_channel,).</p>
<p>In case of multiple occurrences of the maximum values, the indices corresponding to the first occurrence
are returned.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">]]</span>
<span class="n">argmax_channel</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_index.cc:L78</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.argmin">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">argmin</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.argmin" title="Permalink to this definition"></a></dt>
<dd><p>Returns indices of the minimum values along an axis.</p>
<p>In the case of multiple occurrences of minimum values, the indices corresponding to the first occurrence
are returned.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 0., 1., 2.],
[ 3., 4., 5.]]
// argmin along axis 0
argmin(x, axis=0) = [ 0., 0., 0.]
// argmin along axis 1
argmin(x, axis=1) = [ 0., 0.]
// argmin along axis 1 keeping same dims as an input array
argmin(x, axis=1, keepdims=True) = [[ 0.],
[ 0.]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_index.cc:L58</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>int or None, optional, default='None'</em>) – The axis along which to perform the reduction. Negative values means indexing from right to left. <code class="docutils literal"><span class="pre">Requires</span> <span class="pre">axis</span> <span class="pre">to</span> <span class="pre">be</span> <span class="pre">set</span> <span class="pre">as</span> <span class="pre">int,</span> <span class="pre">because</span> <span class="pre">global</span> <span class="pre">reduction</span> <span class="pre">is</span> <span class="pre">not</span> <span class="pre">supported</span> <span class="pre">yet.</span></code></li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axis is left in the result as dimension with size one.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.argsort">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">argsort</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>is_ascend=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.argsort" title="Permalink to this definition"></a></dt>
<dd><p>Returns the indices that would sort an input array along the given axis.</p>
<p>This function performs sorting along the given axis and returns an array of indices having same shape
as an input array that index data in sorted order.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 0.3, 0.2, 0.4],
[ 0.1, 0.3, 0.2]]
// sort along axis -1
argsort(x) = [[ 1., 0., 2.],
[ 0., 2., 1.]]
// sort along axis 0
argsort(x, axis=0) = [[ 1., 0., 1.]
[ 0., 1., 0.]]
// flatten and then sort
argsort(x) = [ 3., 1., 5., 0., 4., 2.]
</pre></div>
</div>
<p>Defined in src/operator/tensor/ordering_op.cc:L157</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array</li>
<li><strong>axis</strong> (<em>int or None, optional, default='-1'</em>) – Axis along which to sort the input tensor. If not given, the flattened array is used. Default is -1.</li>
<li><strong>is_ascend</strong> (<em>boolean, optional, default=True</em>) – Whether to sort in ascending or descending order.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.batch_dot">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">batch_dot</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>transpose_a=_Null</em>, <em>transpose_b=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.batch_dot" title="Permalink to this definition"></a></dt>
<dd><p>Batchwise dot product.</p>
<p><code class="docutils literal"><span class="pre">batch_dot</span></code> is used to compute dot product of <code class="docutils literal"><span class="pre">x</span></code> and <code class="docutils literal"><span class="pre">y</span></code> when <code class="docutils literal"><span class="pre">x</span></code> and
<code class="docutils literal"><span class="pre">y</span></code> are data in batch, namely 3D arrays in shape of <cite>(batch_size, :, :)</cite>.</p>
<p>For example, given <code class="docutils literal"><span class="pre">x</span></code> with shape <cite>(batch_size, n, m)</cite> and <code class="docutils literal"><span class="pre">y</span></code> with shape
<cite>(batch_size, m, k)</cite>, the result array will have shape <cite>(batch_size, n, k)</cite>,
which is computed by:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">batch_dot</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="n">i</span><span class="p">,:,:]</span> <span class="o">=</span> <span class="n">dot</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">,:,:],</span> <span class="n">y</span><span class="p">[</span><span class="n">i</span><span class="p">,:,:])</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L411</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The second input</li>
<li><strong>transpose_a</strong> (<em>boolean, optional, default=False</em>) – If true then transpose the first input before dot.</li>
<li><strong>transpose_b</strong> (<em>boolean, optional, default=False</em>) – If true then transpose the second input before dot.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.batch_take">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">batch_take</code><span class="sig-paren">(</span><em>a=None</em>, <em>indices=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.batch_take" title="Permalink to this definition"></a></dt>
<dd><p>Takes elements from a data batch.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>batch_take</cite> is deprecated. Use <cite>pick</cite> instead.</p>
</div>
<p>Given an input array of shape <code class="docutils literal"><span class="pre">(d0,</span> <span class="pre">d1)</span></code> and indices of shape <code class="docutils literal"><span class="pre">(i0,)</span></code>, the result will be
an output array of shape <code class="docutils literal"><span class="pre">(i0,)</span></code> with:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">output</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="nb">input</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">indices</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span>
</pre></div>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 1., 2.],
[ 3., 4.],
[ 5., 6.]]
// takes elements with specified indices
batch_take(x, [0,1,0]) = [ 1. 4. 5.]
</pre></div>
</div>
<p>Defined in src/operator/tensor/indexing_op.cc:L172</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array</li>
<li><strong>indices</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The index array</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_add">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_add</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_add" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise sum of the input arrays with broadcasting.</p>
<p><cite>broadcast_plus</cite> is an alias to the function <cite>broadcast_add</cite>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_add</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]]</span>
<span class="n">broadcast_plus</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L32</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_axes">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_axes</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>size=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_axes" title="Permalink to this definition"></a></dt>
<dd><p>Broadcasts the input array over particular axes.</p>
<p>Broadcasting is allowed on axes with size 1, such as from <cite>(2,1,3,1)</cite> to
<cite>(2,8,3,9)</cite>. Elements will be duplicated on the broadcasted axes.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// given x of shape (1,2,1)
x = [[[ 1.],
[ 2.]]]
// broadcast x on on axis 2
broadcast_axis(x, axis=2, size=3) = [[[ 1., 1., 1.],
[ 2., 2., 2.]]]
// broadcast x on on axes 0 and 2
broadcast_axis(x, axis=(0,2), size=(2,3)) = [[[ 1., 1., 1.],
[ 2., 2., 2.]],
[[ 1., 1., 1.],
[ 2., 2., 2.]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L168</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – The axes to perform the broadcasting.</li>
<li><strong>size</strong> (<em>Shape(tuple), optional, default=()</em>) – Target sizes of the broadcasting axes.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_axis">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_axis</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>size=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_axis" title="Permalink to this definition"></a></dt>
<dd><p>Broadcasts the input array over particular axes.</p>
<p>Broadcasting is allowed on axes with size 1, such as from <cite>(2,1,3,1)</cite> to
<cite>(2,8,3,9)</cite>. Elements will be duplicated on the broadcasted axes.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// given x of shape (1,2,1)
x = [[[ 1.],
[ 2.]]]
// broadcast x on on axis 2
broadcast_axis(x, axis=2, size=3) = [[[ 1., 1., 1.],
[ 2., 2., 2.]]]
// broadcast x on on axes 0 and 2
broadcast_axis(x, axis=(0,2), size=(2,3)) = [[[ 1., 1., 1.],
[ 2., 2., 2.]],
[[ 1., 1., 1.],
[ 2., 2., 2.]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L168</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – The axes to perform the broadcasting.</li>
<li><strong>size</strong> (<em>Shape(tuple), optional, default=()</em>) – Target sizes of the broadcasting axes.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_div">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_div</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_div" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise division of the input arrays with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">]]</span>
<span class="n">broadcast_div</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="o">=</span> <span class="p">[[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L137</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_equal</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>equal to</strong> (==) comparison operation with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_equal</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="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_logic.cc:L27</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_greater">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_greater</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_greater" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>greater than</strong> (>) comparison operation with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_greater</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_logic.cc:L63</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_greater_equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_greater_equal</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_greater_equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>greater than or equal to</strong> (>=) comparison operation with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_greater_equal</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_logic.cc:L81</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_hypot">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_hypot</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_hypot" title="Permalink to this definition"></a></dt>
<dd><p>Returns the hypotenuse of a right angled triangle, given its “legs”
with broadcasting.</p>
<p>It is equivalent to doing <span class="math">\(sqrt(x_1^2 + x_2^2)\)</span>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">4.</span><span class="p">]]</span>
<span class="n">broadcast_hypot</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="o">=</span> <span class="p">[[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">]]</span>
<span class="n">z</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">4.</span><span class="p">]]</span>
<span class="n">broadcast_hypot</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">z</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_extended.cc:L137</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_lesser">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_lesser</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_lesser" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>lesser than</strong> (<) comparison operation with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_lesser</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="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_logic.cc:L99</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_lesser_equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_lesser_equal</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_lesser_equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>lesser than or equal to</strong> (<=) comparison operation with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_lesser_equal</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="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_logic.cc:L117</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_maximum">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_maximum</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_maximum" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise maximum of the input arrays with broadcasting.</p>
<p>This function compares two input arrays and returns a new array having the element-wise maxima.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_maximum</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_extended.cc:L61</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_minimum">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_minimum</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_minimum" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise minimum of the input arrays with broadcasting.</p>
<p>This function compares two input arrays and returns a new array having the element-wise minima.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_maximum</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="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_extended.cc:L96</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_minus">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_minus</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_minus" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise difference of the input arrays with broadcasting.</p>
<p><cite>broadcast_minus</cite> is an alias to the function <cite>broadcast_sub</cite>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_sub</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
<span class="n">broadcast_minus</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L71</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_mod">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_mod</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_mod" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise modulo of the input arrays with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">]]</span>
<span class="n">broadcast_mod</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="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L170</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_mul">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_mul</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_mul" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise product of the input arrays with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_mul</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="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L104</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_not_equal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_not_equal</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_not_equal" title="Permalink to this definition"></a></dt>
<dd><p>Returns the result of element-wise <strong>not equal to</strong> (!=) comparison operation with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_not_equal</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_logic.cc:L45</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_plus">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_plus</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_plus" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise sum of the input arrays with broadcasting.</p>
<p><cite>broadcast_plus</cite> is an alias to the function <cite>broadcast_add</cite>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_add</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]]</span>
<span class="n">broadcast_plus</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L32</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_power">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_power</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_power" title="Permalink to this definition"></a></dt>
<dd><p>Returns result of first array elements raised to powers from second array, element-wise with broadcasting.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_power</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="o">=</span> <span class="p">[[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_extended.cc:L26</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_sub">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_sub</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_sub" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise difference of the input arrays with broadcasting.</p>
<p><cite>broadcast_minus</cite> is an alias to the function <cite>broadcast_sub</cite>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">broadcast_sub</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
<span class="n">broadcast_minus</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L71</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – First input to the function</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.broadcast_to">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">broadcast_to</code><span class="sig-paren">(</span><em>data=None</em>, <em>shape=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.broadcast_to" title="Permalink to this definition"></a></dt>
<dd><p>Broadcasts the input array to a new shape.</p>
<p>Broadcasting is a mechanism that allows NDArrays to perform arithmetic operations
with arrays of different shapes efficiently without creating multiple copies of arrays.
Also see, <a class="reference external" href="https://docs.scipy.org/doc/numpy/user/basics.broadcasting.html">Broadcasting</a> for more explanation.</p>
<p>Broadcasting is allowed on axes with size 1, such as from <cite>(2,1,3,1)</cite> to
<cite>(2,8,3,9)</cite>. Elements will be duplicated on the broadcasted axes.</p>
<p>For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>broadcast_to([[1,2,3]], shape=(2,3)) = [[ 1., 2., 3.],
[ 1., 2., 3.]])
</pre></div>
</div>
<p>The dimension which you do not want to change can also be kept as <cite>0</cite> which means copy the original value.
So with <cite>shape=(2,0)</cite>, we will obtain the same result as in the above example.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L192</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – The shape of the desired array. We can set the dim to zero if it’s same as the original. E.g <cite>A = broadcast_to(B, shape=(10, 0, 0))</cite> has the same meaning as <cite>A = broadcast_axis(B, axis=0, size=10)</cite>.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.cast">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">cast</code><span class="sig-paren">(</span><em>data=None</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.cast" title="Permalink to this definition"></a></dt>
<dd><p>Casts all elements of the input to a new type.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">Cast</span></code> is deprecated. Use <code class="docutils literal"><span class="pre">cast</span></code> instead.</p>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">cast</span><span class="p">([</span><span class="mf">0.9</span><span class="p">,</span> <span class="mf">1.3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'int32'</span><span class="p">)</span> <span class="o">=</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="n">cast</span><span class="p">([</span><span class="mf">1e20</span><span class="p">,</span> <span class="mf">11.1</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'float16'</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="n">inf</span><span class="p">,</span> <span class="mf">11.09375</span><span class="p">]</span>
<span class="n">cast</span><span class="p">([</span><span class="mi">300</span><span class="p">,</span> <span class="mf">11.1</span><span class="p">,</span> <span class="mf">10.9</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">3</span><span class="p">],</span> <span class="n">dtype</span><span class="o">=</span><span class="s1">'uint8'</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="mi">44</span><span class="p">,</span> <span class="mi">11</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">253</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L175</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input.</li>
<li><strong>dtype</strong> (<em>{'float16', 'float32', 'float64', 'int32', 'uint8'}, required</em>) – Output data type.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.ceil">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">ceil</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.ceil" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise ceiling of the input.</p>
<p>The ceil of the scalar x is the smallest integer i, such that i >= x.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">ceil</span><span class="p">([</span><span class="o">-</span><span class="mf">2.1</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.9</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mf">2.1</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L277</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.choose_element_0index">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">choose_element_0index</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.choose_element_0index" title="Permalink to this definition"></a></dt>
<dd><p>Choose one element from each line(row for python, column for R/Julia) in lhs according to index indicated by rhs. This function assume rhs uses 0-based index.</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Left operand to the function.</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Right operand to the function.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.clip">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">clip</code><span class="sig-paren">(</span><em>data=None</em>, <em>a_min=_Null</em>, <em>a_max=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.clip" title="Permalink to this definition"></a></dt>
<dd><p>Clips (limits) the values in an array.</p>
<p>Given an interval, values outside the interval are clipped to the interval edges.
Clipping <code class="docutils literal"><span class="pre">x</span></code> between <cite>a_min</cite> and <cite>a_x</cite> would be:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>clip(x, a_min, a_max) = max(min(x, a_max), a_min))
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</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">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">]</span>
<span class="n">clip</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">8</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L456</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>a_min</strong> (<em>float, required</em>) – Minimum value</li>
<li><strong>a_max</strong> (<em>float, required</em>) – Maximum value</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.concat">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">concat</code><span class="sig-paren">(</span><em>*data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.concat" title="Permalink to this definition"></a></dt>
<dd><p>Joins input arrays along a given axis.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>Concat</cite> is deprecated. Use <cite>concat</cite> instead.</p>
</div>
<p>The dimensions of the input arrays should be the same except the axis along
which they will be concatenated.
The dimension of the output array along the concatenated axis will be equal
to the sum of the corresponding dimensions of the input arrays.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[1,1],[2,2]]
y = [[3,3],[4,4],[5,5]]
z = [[6,6], [7,7],[8,8]]
concat(x,y,z,dim=0) = [[ 1., 1.],
[ 2., 2.],
[ 3., 3.],
[ 4., 4.],
[ 5., 5.],
[ 6., 6.],
[ 7., 7.],
[ 8., 8.]]
Note that you cannot concat x,y,z along dimension 1 since dimension
0 is not the same for all the input arrays.
concat(y,z,dim=1) = [[ 3., 3., 6., 6.],
[ 4., 4., 7., 7.],
[ 5., 5., 8., 8.]]
</pre></div>
</div>
<p>Defined in src/operator/concat.cc:L80</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>data</strong> (<em>NDArray[]</em>) – List of arrays to concatenate</li>
<li><strong>dim</strong> (<em>int, optional, default='1'</em>) – the dimension to be concated.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.cos">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">cos</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.cos" title="Permalink to this definition"></a></dt>
<dd><p>Computes the element-wise cosine of the input array.</p>
<p>The input should be in radians (<span class="math">\(2\pi\)</span> rad equals 360 degrees).</p>
<div class="math">
\[cos([0, \pi/4, \pi/2]) = [1, 0.707, 0]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L473</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.cosh">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">cosh</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.cosh" title="Permalink to this definition"></a></dt>
<dd><p>Returns the hyperbolic cosine of the input array, computed element-wise.</p>
<div class="math">
\[cosh(x) = 0.5\times(exp(x) + exp(-x))\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L595</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.crop">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">crop</code><span class="sig-paren">(</span><em>data=None</em>, <em>begin=_Null</em>, <em>end=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.crop" title="Permalink to this definition"></a></dt>
<dd><p>Slices a contiguous region of the array.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">crop</span></code> is deprecated. Use <code class="docutils literal"><span class="pre">slice</span></code> instead.</p>
</div>
<p>This function returns a sliced continuous region of the array between the indices given
by <cite>begin</cite> and <cite>end</cite>.</p>
<p>For an input array of <cite>n</cite> dimensions, slice operation with <code class="docutils literal"><span class="pre">begin=(b_0,</span> <span class="pre">b_1...b_n-1)</span></code> indices
and <code class="docutils literal"><span class="pre">end=(e_1,</span> <span class="pre">e_2,</span> <span class="pre">...</span> <span class="pre">e_n)</span></code> indices will result in an array with the shape
<code class="docutils literal"><span class="pre">(e_1-b_0,</span> <span class="pre">...,</span> <span class="pre">e_n-b_n-1)</span></code>.</p>
<p>The resulting array’s <em>k</em>-th dimension contains elements
from the <em>k</em>-th dimension of the input array with the open range <code class="docutils literal"><span class="pre">[b_k,</span> <span class="pre">e_k)</span></code>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">9.</span><span class="p">,</span> <span class="mf">10.</span><span class="p">,</span> <span class="mf">11.</span><span class="p">,</span> <span class="mf">12.</span><span class="p">]]</span>
<span class="nb">slice</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">begin</span><span class="o">=</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="n">end</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L256</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Source input</li>
<li><strong>begin</strong> (<em>Shape(tuple), required</em>) – starting indices for the slice operation, supports negative indices.</li>
<li><strong>end</strong> (<em>Shape(tuple), required</em>) – ending indices for the slice operation, supports negative indices.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.degrees">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">degrees</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.degrees" title="Permalink to this definition"></a></dt>
<dd><p>Converts each element of the input array from radians to degrees.</p>
<div class="math">
\[degrees([0, \pi/2, \pi, 3\pi/2, 2\pi]) = [0, 90, 180, 270, 360]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L553</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.dot">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">dot</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>transpose_a=_Null</em>, <em>transpose_b=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.dot" title="Permalink to this definition"></a></dt>
<dd><p>Dot product of two arrays.</p>
<p><code class="docutils literal"><span class="pre">dot</span></code>‘s behavior depends on the input array dimensions:</p>
<ul>
<li><p class="first">1-D arrays: inner product of vectors</p>
</li>
<li><p class="first">2-D arrays: matrix multiplication</p>
</li>
<li><p class="first">N-D arrays: a sum product over the last axis of the first input and the first
axis of the second input</p>
<p>For example, given 3-D <code class="docutils literal"><span class="pre">x</span></code> with shape <cite>(n,m,k)</cite> and <code class="docutils literal"><span class="pre">y</span></code> with shape <cite>(k,r,s)</cite>, the
result array will have shape <cite>(n,m,r,s)</cite>. It is computed by:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">dot</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="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">,</span><span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">]</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">,:]</span><span class="o">*</span><span class="n">y</span><span class="p">[:,</span><span class="n">a</span><span class="p">,</span><span class="n">b</span><span class="p">])</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="n">reshape</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">2</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">7</span><span class="p">],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="n">y</span> <span class="o">=</span> <span class="n">reshape</span><span class="p">([</span><span class="mi">7</span><span class="p">,</span><span class="mi">6</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">4</span><span class="p">,</span><span class="mi">3</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span>
<span class="n">dot</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="mi">0</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">1</span><span class="p">]</span> <span class="o">=</span> <span class="mi">0</span>
<span class="nb">sum</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,:]</span><span class="o">*</span><span class="n">y</span><span class="p">[:,</span><span class="mi">1</span><span class="p">,</span><span class="mi">1</span><span class="p">])</span> <span class="o">=</span> <span class="mi">0</span>
</pre></div>
</div>
</li>
</ul>
<p>Defined in src/operator/tensor/matrix_op.cc:L375</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The second input</li>
<li><strong>transpose_a</strong> (<em>boolean, optional, default=False</em>) – If true then transpose the first input before dot.</li>
<li><strong>transpose_b</strong> (<em>boolean, optional, default=False</em>) – If true then transpose the second input before dot.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.elemwise_add">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">elemwise_add</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.elemwise_add" title="Permalink to this definition"></a></dt>
<dd><p>Adds arguments element-wise.</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – second input</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Example</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">y</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mf">1.1</span><span class="p">,</span> <span class="mf">2.1</span><span class="p">,</span> <span class="mf">3.1</span><span class="p">,</span> <span class="mf">4.1</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">elemwise_add</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="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 2.0999999 , 4.0999999 , 6.0999999 , 8.10000038], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.exp">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">exp</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.exp" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise exponential value of the input.</p>
<div class="math">
\[exp(x) = e^x \approx 2.718^x\]</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">exp</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">2</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="n">inf</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">0.707</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L384</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.expand_dims">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">expand_dims</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.expand_dims" title="Permalink to this definition"></a></dt>
<dd><p>Inserts a new axis of size 1 into the array shape</p>
<p>For example, given <code class="docutils literal"><span class="pre">x</span></code> with shape <code class="docutils literal"><span class="pre">(2,3,4)</span></code>, then <code class="docutils literal"><span class="pre">expand_dims(x,</span> <span class="pre">axis=1)</span></code>
will return a new array with shape <code class="docutils literal"><span class="pre">(2,1,3,4)</span></code>.</p>
<p>Defined in src/operator/tensor/matrix_op.cc:L212</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Source input</li>
<li><strong>axis</strong> (<em>int, required</em>) – Position where new axis is to be inserted. Suppose that the input <cite>NDArray</cite>‘s dimension is <cite>ndim</cite>, the range of the inserted axis is <cite>[-ndim, ndim]</cite></li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.expm1">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">expm1</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.expm1" title="Permalink to this definition"></a></dt>
<dd><p>Returns <code class="docutils literal"><span class="pre">exp(x)</span> <span class="pre">-</span> <span class="pre">1</span></code> computed element-wise on the input.</p>
<p>This function provides greater precision than <code class="docutils literal"><span class="pre">exp(x)</span> <span class="pre">-</span> <span class="pre">1</span></code> for small values of <code class="docutils literal"><span class="pre">x</span></code>.</p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L457</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.fill_element_0index">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">fill_element_0index</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>mhs=None</em>, <em>rhs=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.fill_element_0index" title="Permalink to this definition"></a></dt>
<dd><p>Fill one element of each line(row for python, column for R/Julia) in lhs according to index indicated by rhs and values indicated by mhs. This function assume rhs uses 0-based index.</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Left operand to the function.</li>
<li><strong>mhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Middle operand to the function.</li>
<li><strong>rhs</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Right operand to the function.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.fix">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">fix</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.fix" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise rounded value to the nearest integer towards zero of the input.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">fix</span><span class="p">([</span><span class="o">-</span><span class="mf">2.1</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.9</span><span class="p">,</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mf">2.1</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L315</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.flatten">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">flatten</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.flatten" title="Permalink to this definition"></a></dt>
<dd><p>Flattens the input array into a 2-D array by collapsing the higher dimensions.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>Flatten</cite> is deprecated. Use <cite>flatten</cite> instead.</p>
</div>
<p>For an input array with shape <code class="docutils literal"><span class="pre">(d1,</span> <span class="pre">d2,</span> <span class="pre">...,</span> <span class="pre">dk)</span></code>, <cite>flatten</cite> operation reshapes
the input array into an output array of shape <code class="docutils literal"><span class="pre">(d1,</span> <span class="pre">d2*...*dk)</span></code>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span>
<span class="p">[</span><span class="mi">1</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="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">],</span>
<span class="p">[</span><span class="mi">7</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">]</span>
<span class="p">],</span>
<span class="p">[</span> <span class="p">[</span><span class="mi">1</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="p">[</span><span class="mi">4</span><span class="p">,</span><span class="mi">5</span><span class="p">,</span><span class="mi">6</span><span class="p">],</span>
<span class="p">[</span><span class="mi">7</span><span class="p">,</span><span class="mi">8</span><span class="p">,</span><span class="mi">9</span><span class="p">]</span>
<span class="p">]],</span>
<span class="n">flatten</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L131</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.flip">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">flip</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.flip" title="Permalink to this definition"></a></dt>
<dd><p>Reverses the order of elements along given axis while preserving array shape.</p>
<p>Note: reverse and flip are equivalent. We use reverse in the following examples.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">]]</span>
<span class="n">reverse</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
<span class="n">reverse</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">9.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L600</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data array</li>
<li><strong>axis</strong> (<em>Shape(tuple), required</em>) – The axis which to reverse elements.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.floor">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">floor</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.floor" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise floor of the input.</p>
<p>The floor of the scalar x is the largest integer i, such that i <= x.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">floor</span><span class="p">([</span><span class="o">-</span><span class="mf">2.1</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.9</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mf">2.1</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">3.</span><span class="p">,</span> <span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L290</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.gamma">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">gamma</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.gamma" title="Permalink to this definition"></a></dt>
<dd><p>Returns the gamma function (extension of the factorial function to the reals) , computed element-wise on the input array.</p>
<p>From:src/operator/tensor/elemwise_unary_op.cc:649</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.gammaln">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">gammaln</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.gammaln" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise log of the absolute value of the gamma function of the input.</p>
<p>From:src/operator/tensor/elemwise_unary_op.cc:659</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.identity">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">identity</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.identity" title="Permalink to this definition"></a></dt>
<dd><p>Returns a copy of the input.</p>
<p>From:src/operator/tensor/elemwise_unary_op.cc:49</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.linalg_gemm">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">linalg_gemm</code><span class="sig-paren">(</span><em>A=None</em>, <em>B=None</em>, <em>C=None</em>, <em>transpose_a=_Null</em>, <em>transpose_b=_Null</em>, <em>alpha=_Null</em>, <em>beta=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.linalg_gemm" title="Permalink to this definition"></a></dt>
<dd><p>Performs general matrix multiplication and accumulation.
Input are three tensors <em>A</em>, <em>B</em>, <em>C</em> each of dimension <em>n >= 2</em> and each
having the same shape on the leading <em>n-2</em> dimensions. For every <em>n-2</em> dimensional index <em>i</em> let
<em>A</em><sub>i</sub>, <em>B</em><sub>i</sub>, <em>C</em><sub>i</sub> be the matrices given by the last <em>2</em> dimensions.
The operator performs the BLAS3 function <em>gemm</em></p>
<blockquote>
<div><em>out</em><sub>i</sub> = <em>alpha</em> * <em>op</em>(<em>A</em><sub>i</sub>) * <em>op</em>(<em>B</em><sub>i</sub>) + <em>beta</em> * <em>C</em><sub>i</sub></div></blockquote>
<p>on all such triples of matrices. Here <em>alpha</em> and <em>beta</em> are scalar operator parameters and <em>op()</em>
is either the identity or the matrix transposition.</p>
<p>In case of <em>n=2</em>, a single <em>gemm</em> function is performed on the matrices <em>A</em>, <em>B</em>, <em>C</em>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The operator does only support float32 and float64 data types and provides
proper backward gradients.</p>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Single matrix multiply-add
A = [[1.0, 1.0], [1.0, 1.0]]
B = [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]]
C = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
linalg_gemm(A, B, C, transpose_b = 1, alpha = 2.0 , beta = 10.0)
= [[14.0, 14.0, 14.0], [14.0, 14.0, 14.0]]
// Batch matrix multiply-add
A = [[[1.0, 1.0]], [[0.1, 0.1]]]
B = [[[1.0, 1.0]], [[0.1, 0.1]]]
C = [[[10.0]], [[0.01]]]
linalg_gemm(A, B, C, transpose_b = 1, alpha = 2.0 , beta = 10.0)
= [[[104.0]], [[0.14]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/la_op.cc:L48</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of input matrices</li>
<li><strong>B</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of input matrices</li>
<li><strong>C</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of input matrices</li>
<li><strong>transpose_a</strong> (<em>boolean, optional, default=False</em>) – Multiply with transposed of first input (A).</li>
<li><strong>transpose_b</strong> (<em>boolean, optional, default=False</em>) – Multiply with transposed of second input (B).</li>
<li><strong>alpha</strong> (<em>double, optional, default=1</em>) – Scalar factor multiplied with A*B.</li>
<li><strong>beta</strong> (<em>double, optional, default=1</em>) – Scalar factor multiplied with C.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.linalg_gemm2">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">linalg_gemm2</code><span class="sig-paren">(</span><em>A=None</em>, <em>B=None</em>, <em>transpose_a=_Null</em>, <em>transpose_b=_Null</em>, <em>alpha=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.linalg_gemm2" title="Permalink to this definition"></a></dt>
<dd><p>Performs general matrix multiplication.
Input are two tensors <em>A</em>, <em>B</em> each of dimension <em>n >= 2</em> and each
having the same shape on the leading <em>n-2</em> dimensions. For every <em>n-2</em> dimensional index <em>i</em> let
<em>A</em><sub>i</sub>, <em>B</em><sub>i</sub> be the matrices given by the last <em>2</em> dimensions.
The operator performs the BLAS3 function <em>gemm</em> (restricted to two arguments)</p>
<blockquote>
<div><em>out</em><sub>i</sub> = <em>alpha</em> * <em>op</em>(<em>A</em><sub>i</sub>) * <em>op</em>(<em>B</em><sub>i</sub>)</div></blockquote>
<p>on all such pairs of matrices. Here <em>alpha</em> is a scalar operator parameter and <em>op()</em> is either
the identity or the matrix transposition.</p>
<p>In case of <em>n=2</em>, a single <em>gemm</em> function is performed on the matrices <em>A</em>, <em>B</em>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The operator does only support float32 and float64 data types and provides
proper backward gradients.</p>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Single matrix multiply
A = [[1.0, 1.0], [1.0, 1.0]]
B = [[1.0, 1.0], [1.0, 1.0], [1.0, 1.0]]
linalg_gemm2(A, B, transpose_b = 1, alpha = 2.0)
= [[4.0, 4.0, 4.0], [4.0, 4.0, 4.0]]
// Batch matrix multiply
A = [[[1.0, 1.0]], [[0.1, 0.1]]]
B = [[[1.0, 1.0]], [[0.1, 0.1]]]
linalg_gemm2(A, B, transpose_b = 1, alpha = 2.0 )
= [[[4.0]], [[0.04 ]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/la_op.cc:L106</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of input matrices</li>
<li><strong>B</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of input matrices</li>
<li><strong>transpose_a</strong> (<em>boolean, optional, default=False</em>) – Multiply with transposed of first input (A).</li>
<li><strong>transpose_b</strong> (<em>boolean, optional, default=False</em>) – Multiply with transposed of second input (B).</li>
<li><strong>alpha</strong> (<em>double, optional, default=1</em>) – Scalar factor multiplied with A*B.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.linalg_potrf">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">linalg_potrf</code><span class="sig-paren">(</span><em>A=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.linalg_potrf" title="Permalink to this definition"></a></dt>
<dd><p>Performs Cholesky factorization of a symmetric positive-definite matrix.
Input is a tensor <em>A</em> of dimension <em>n >= 2</em>. For every <em>n-2</em> dimensional index <em>i</em> let
<em>A</em><sub>i</sub> be the matrix given by the last <em>2</em> dimensions.
The operator performs the Cholesky factorization (LAPACK function <em>potrf</em>)
on each <em>A</em><sub>i</sub>,
i.e. it computes a lower triangular matrix <em>U</em><sub>i</sub> such that</p>
<blockquote>
<div><em>A</em><sub>i</sub> = <em>U</em><sub>i</sub> * <em>U</em><sub>i</sub><sup>T</sup></div></blockquote>
<p>for all such matrices. The matrices <em>A</em><sub>i</sub> must be all symmetric and positive-definite.
The resulting matrices <em>U</em><sub>i</sub> will contain zeros in the upper triangle
apart from the diagonal.</p>
<p>In case of <em>n=2</em>, a single Cholesky factorization is performed on the matrix <em>A</em>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The operator does only support float32 and float64 data types and provides
proper backward gradients.</p>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Single matrix factorization
A = [[4.0, 1.0], [1.0, 4.25]]
linalg_potrf(A) = [[2.0, 0], [0.5, 2.0]]
// Batch matrix factorization
A = [[[4.0, 1.0], [1.0, 4.25]], [[16.0, 4.0], [4.0, 17.0]]]
linalg_potrf(A) = [[[2.0, 0], [0.5, 2.0]], [[4.0, 0], [1.0, 4.0]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/la_op.cc:L159</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of input matrices to be decomposed</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.linalg_potri">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">linalg_potri</code><span class="sig-paren">(</span><em>A=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.linalg_potri" title="Permalink to this definition"></a></dt>
<dd><p>Performs matrix inversion from a Cholesky factorization.
Input is a tensor <em>A</em> of dimension <em>n >= 2</em>. For every <em>n-2</em> dimensional index <em>i</em> let
<em>A</em><sub>i</sub> be the matrix given by the last <em>2</em> dimensions.
The operator assumes that each <em>A</em><sub>i</sub> is the Cholesky factorization of some symmetric
positive-definite matrix <em>B</em><sub>i</sub> given as a lower triangular matrix
(so <em>A</em> is the output of a prior call to operator <em>linalg_potrf</em>). The operator computes the
inverse of each <em>B</em><sub>i</sub> from this decomposition, i.e</p>
<blockquote>
<div><em>out</em><sub>i</sub> = <em>B</em><sub>i</sub><sup>-1</sup></div></blockquote>
<p>for all such matrices.</p>
<p>In case of <em>n=2</em>, the operation is performed on the matrix <em>A</em> itself.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The operator does only support float32 and float64 data types and provides
proper backward gradients.</p>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Single matrix inverse
A = [[2.0, 0], [0.5, 2.0]]
linalg_potri(A) = [[0.26563, -0.0625], [-0.0625, 0.25]]
// Batch matrix inverse
A = [[[2.0, 0], [0.5, 2.0]], [[4.0, 0], [1.0, 4.0]]]
linalg_potri(A) = [[[0.26563, -0.0625], [-0.0625, 0.25]],
[[0.06641, -0.01562], [-0.01562, 0,0625]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/la_op.cc:L211</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of lower triangular matrices</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.linalg_sumlogdiag">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">linalg_sumlogdiag</code><span class="sig-paren">(</span><em>A=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.linalg_sumlogdiag" title="Permalink to this definition"></a></dt>
<dd><p>Computes the sum of the logarithms of all diagonal elements in a matrix.
Input is a tensor <em>A</em> of dimension <em>n >= 2</em>. For every <em>n-2</em> dimensional index <em>i</em> let
<em>A</em><sub>i</sub> be the matrix given by the last <em>2</em> dimensions.
The operator performs a reduction of each such matrix to a scalar by summing up the logarithms
of all diagonal elements. All matrices must be square and all diagonal elements must be positive.</p>
<p>In case of <em>n=2</em>, <em>A</em> represents a single matrix on which the reduction will be performed.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The operator does only support float32 and float64 data types and provides
proper backward gradients.</p>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Single matrix reduction
A = [[1.0, 1.0], [1.0, 7.0]]
linalg_sumlogdiag(A) = [1.9459]
// Batch matrix reduction
A = [[[1.0, 1.0], [1.0, 7.0]], [[3.0, 0], [0, 17.0]]]
linalg_sumlogdiag(A) = [1.9459, 3.9318]
</pre></div>
</div>
<p>Defined in src/operator/tensor/la_op.cc:L379</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of square matrices</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.linalg_trmm">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">linalg_trmm</code><span class="sig-paren">(</span><em>A=None</em>, <em>B=None</em>, <em>transpose=_Null</em>, <em>rightside=_Null</em>, <em>alpha=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.linalg_trmm" title="Permalink to this definition"></a></dt>
<dd><p>Performs multiplication with a triangular matrix.
Input are two tensors <em>A</em>, <em>B</em> each of dimension <em>n >= 2</em> and each
having the same shape on the leading <em>n-2</em> dimensions. For every <em>n-2</em> dimensional index <em>i</em> let
<em>A</em><sub>i</sub>, <em>B</em><sub>i</sub> be the matrices given by the last <em>2</em> dimensions.
The operator performs the BLAS3 function <em>trmm</em></p>
<blockquote>
<div><em>out</em><sub>i</sub> = <em>alpha</em> * <em>op</em>(<em>A</em><sub>i</sub>) * <em>B</em><sub>i</sub></div></blockquote>
<p>or</p>
<blockquote>
<div><em>out</em><sub>i</sub> = <em>alpha</em> * <em>B</em><sub>i</sub> * <em>op</em>(<em>A</em><sub>i</sub>)</div></blockquote>
<p>on all such pairs of matrices. Here <em>alpha</em> is a scalar operator parameter, <em>op()</em> is either
the identity or the matrix transposition (depending on the parameter <em>transpose</em>) and the
order of matrix multiplication depends on the parameter <em>rightside</em>.
All matrices <em>A</em><sub>i</sub> must be lower triangular.</p>
<p>In case of <em>n=2</em>, a single <em>trmm</em> function is performed on the matrices <em>A</em>, <em>B</em>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The operator does only support float32 and float64 data types and provides
proper backward gradients.</p>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Single matrix multiply
A = [[1.0, 0], [1.0, 1.0]]
B = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
linalg_trmm(A, B, alpha = 2.0) = [[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]]
// Batch matrix multiply
A = [[[1.0, 0], [1.0, 1.0]], [[1.0, 0], [1.0, 1.0]]]
B = [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]], [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]]
linalg_trmm(A, B, alpha = 2.0 ) = [[[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]],
[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/la_op.cc:L268</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of lower triangular matrices</li>
<li><strong>B</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of matrices</li>
<li><strong>transpose</strong> (<em>boolean, optional, default=False</em>) – Use transposed of the triangular matrix</li>
<li><strong>rightside</strong> (<em>boolean, optional, default=False</em>) – Multiply triangular matrix from the right to non-triangular one.</li>
<li><strong>alpha</strong> (<em>double, optional, default=1</em>) – Scalar factor to be applied to the result.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.linalg_trsm">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">linalg_trsm</code><span class="sig-paren">(</span><em>A=None</em>, <em>B=None</em>, <em>transpose=_Null</em>, <em>rightside=_Null</em>, <em>alpha=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.linalg_trsm" title="Permalink to this definition"></a></dt>
<dd><p>Solves matrix equations involving a triangular matrix.
Input are two tensors <em>A</em>, <em>B</em> each of dimension <em>n >= 2</em> and each
having the same shape on the leading <em>n-2</em> dimensions. For every <em>n-2</em> dimensional index <em>i</em> let
<em>A</em><sub>i</sub>, <em>B</em><sub>i</sub> be the matrices given by the last <em>2</em> dimensions.
The operator performs the BLAS3 function <em>trsm</em>, i.e. it solves the equation</p>
<blockquote>
<div><em>op</em>(<em>A</em><sub>i</sub>) * <em>X</em><sub>i</sub> = <em>alpha</em> * <em>B</em><sub>i</sub></div></blockquote>
<p>or</p>
<blockquote>
<div><em>X</em><sub>i</sub> * <em>op</em>(<em>A</em><sub>i</sub>) = <em>alpha</em> * <em>B</em><sub>i</sub></div></blockquote>
<p>on all such pairs of matrices. Here <em>alpha</em> is a scalar operator parameter, <em>op()</em> is either
the identity or the matrix transposition (depending on the parameter <em>transpose</em>) and the
order of multiplication on the left depends on the parameter <em>rightside</em>.
All matrices <em>A</em><sub>i</sub> must be lower triangular.</p>
<p>In case of <em>n=2</em>, a single <em>trsm</em> function is performed on the matrices <em>A</em>, <em>B</em>.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The operator does only support float32 and float64 data types and provides
proper backward gradients.</p>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>// Single matrix solve
A = [[1.0, 0], [1.0, 1.0]]
B = [[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]]
linalg_trsm(A, B, alpha = 0.5) = [[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]]
// Batch matrix solve
A = [[[1.0, 0], [1.0, 1.0]], [[1.0, 0], [1.0, 1.0]]]
B = [[[2.0, 2.0, 2.0], [4.0, 4.0, 4.0]],
[[4.0, 4.0, 4.0], [8.0, 8.0, 8.0]]]
linalg_trsm(A, B, alpha = 0.5 ) = [[[1.0, 1.0, 1.0], [1.0, 1.0, 1.0]],
[[2.0, 2.0, 2.0 ], [2.0, 2.0, 2.0]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/la_op.cc:L331</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of lower triangular matrices</li>
<li><strong>B</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Tensor of matrices</li>
<li><strong>transpose</strong> (<em>boolean, optional, default=False</em>) – Use transposed of the triangular matrix</li>
<li><strong>rightside</strong> (<em>boolean, optional, default=False</em>) – Multiply triangular matrix from the right to non-triangular one.</li>
<li><strong>alpha</strong> (<em>double, optional, default=1</em>) – Scalar factor to be applied to the result.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.log">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">log</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.log" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise Natural logarithmic value of the input.</p>
<p>The natural logarithm is logarithm in base <em>e</em>, so that <code class="docutils literal"><span class="pre">log(exp(x))</span> <span class="pre">=</span> <span class="pre">x</span></code></p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L394</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.log10">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">log10</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.log10" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise Base-10 logarithmic value of the input.</p>
<p><code class="docutils literal"><span class="pre">10**log10(x)</span> <span class="pre">=</span> <span class="pre">x</span></code></p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L404</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.log1p">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">log1p</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.log1p" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise <code class="docutils literal"><span class="pre">log(1</span> <span class="pre">+</span> <span class="pre">x)</span></code> value of the input.</p>
<p>This function is more accurate than <code class="docutils literal"><span class="pre">log(1</span> <span class="pre">+</span> <span class="pre">x)</span></code> for small <code class="docutils literal"><span class="pre">x</span></code> so that
<span class="math">\(1+x\approx 1\)</span></p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L444</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.log2">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">log2</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.log2" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise Base-2 logarithmic value of the input.</p>
<p><code class="docutils literal"><span class="pre">2**log2(x)</span> <span class="pre">=</span> <span class="pre">x</span></code></p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L414</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.log_softmax">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">log_softmax</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.log_softmax" title="Permalink to this definition"></a></dt>
<dd><p>Computes the log softmax of the input.
This is equivalent to computing softmax followed by log.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="o">.</span><span class="mi">1</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">log_softmax</span><span class="p">(</span><span class="n">x</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([-1.41702998, -0.41702995, -2.31702995], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">x</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">array</span><span class="p">(</span> <span class="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="o">.</span><span class="mi">1</span><span class="p">],[</span><span class="o">.</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">]]</span> <span class="p">)</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">log_softmax</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[-0.34115392, -0.69314718, -1.24115396],</span>
<span class="go"> [-1.24115396, -0.69314718, -0.34115392]], dtype=float32)</span>
</pre></div>
</div>
<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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>axis</strong> (<em>int, optional, default='-1'</em>) – The axis along which to compute softmax.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.make_loss">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">make_loss</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.make_loss" title="Permalink to this definition"></a></dt>
<dd><p>Stops gradient computation.
.. note:: <code class="docutils literal"><span class="pre">make_loss</span></code> is deprecated, use <code class="docutils literal"><span class="pre">MakeLoss</span></code>.</p>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L110</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.max">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">max</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.max" title="Permalink to this definition"></a></dt>
<dd><p>Computes the max of array elements over given axes.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L121</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.max_axis">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">max_axis</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.max_axis" title="Permalink to this definition"></a></dt>
<dd><p>Computes the max of array elements over given axes.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L121</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.mean">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">mean</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.mean" title="Permalink to this definition"></a></dt>
<dd><p>Computes the mean of array elements over given axes.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L64</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.min">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">min</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.min" title="Permalink to this definition"></a></dt>
<dd><p>Computes the min of array elements over given axes.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L135</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.min_axis">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">min_axis</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.min_axis" title="Permalink to this definition"></a></dt>
<dd><p>Computes the min of array elements over given axes.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L135</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.mp_sgd_mom_update">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">mp_sgd_mom_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>mom=None</em>, <em>weight32=None</em>, <em>lr=_Null</em>, <em>momentum=_Null</em>, <em>wd=_Null</em>, <em>rescale_grad=_Null</em>, <em>clip_gradient=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.mp_sgd_mom_update" title="Permalink to this definition"></a></dt>
<dd><p>Updater function for multi-precision sgd optimizer</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>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>mom</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Momentum</li>
<li><strong>weight32</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight32</li>
<li><strong>lr</strong> (<em>float, required</em>) – Learning rate</li>
<li><strong>momentum</strong> (<em>float, optional, default=0</em>) – The decay rate of momentum estimates at each epoch.</li>
<li><strong>wd</strong> (<em>float, optional, default=0</em>) – Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.</li>
<li><strong>rescale_grad</strong> (<em>float, optional, default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float, optional, default=-1</em>) – Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.mp_sgd_update">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">mp_sgd_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>weight32=None</em>, <em>lr=_Null</em>, <em>wd=_Null</em>, <em>rescale_grad=_Null</em>, <em>clip_gradient=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.mp_sgd_update" title="Permalink to this definition"></a></dt>
<dd><p>Updater function for multi-precision sgd optimizer</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>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – gradient</li>
<li><strong>weight32</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight32</li>
<li><strong>lr</strong> (<em>float, required</em>) – Learning rate</li>
<li><strong>wd</strong> (<em>float, optional, default=0</em>) – Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.</li>
<li><strong>rescale_grad</strong> (<em>float, optional, default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float, optional, default=-1</em>) – Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.nanprod">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">nanprod</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.nanprod" title="Permalink to this definition"></a></dt>
<dd><p>Computes the product of array elements over given axes treating Not a Numbers (<code class="docutils literal"><span class="pre">NaN</span></code>) as one.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L107</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.nansum">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">nansum</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.nansum" title="Permalink to this definition"></a></dt>
<dd><p>Computes the sum of array elements over given axes treating Not a Numbers (<code class="docutils literal"><span class="pre">NaN</span></code>) as zero.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L92</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.norm">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">norm</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.norm" title="Permalink to this definition"></a></dt>
<dd><p>Flattens the input array and then computes the l2 norm.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span>
<span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]]</span>
<span class="n">norm</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="mf">5.47722578</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L218</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Source input</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.normal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">normal</code><span class="sig-paren">(</span><em>loc=_Null</em>, <em>scale=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.normal" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a normal (Gaussian) distribution.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The existing alias <code class="docutils literal"><span class="pre">normal</span></code> is deprecated.</p>
</div>
<p>Samples are distributed according to a normal distribution parametrized by <em>loc</em> (mean) and <em>scale</em> (standard deviation).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_normal</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.89171135</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.16881478</span><span class="p">],</span>
<span class="p">[</span><span class="o">-</span><span class="mf">1.23474145</span><span class="p">,</span> <span class="mf">1.55807114</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L62</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>loc</strong> (<em>float, optional, default=0</em>) – Mean of the distribution.</li>
<li><strong>scale</strong> (<em>float, optional, default=1</em>) – Standard deviation of the distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.one_hot">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">one_hot</code><span class="sig-paren">(</span><em>indices=None</em>, <em>depth=_Null</em>, <em>on_value=_Null</em>, <em>off_value=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.one_hot" title="Permalink to this definition"></a></dt>
<dd><p>Returns a one-hot array.</p>
<p>The locations represented by <cite>indices</cite> take value <cite>on_value</cite>, while all
other locations take value <cite>off_value</cite>.</p>
<p><cite>one_hot</cite> operation with <cite>indices</cite> of shape <code class="docutils literal"><span class="pre">(i0,</span> <span class="pre">i1)</span></code> and <cite>depth</cite> of <code class="docutils literal"><span class="pre">d</span></code> would result
in an output array of shape <code class="docutils literal"><span class="pre">(i0,</span> <span class="pre">i1,</span> <span class="pre">d)</span></code> with:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">output</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">,:]</span> <span class="o">=</span> <span class="n">off_value</span>
<span class="n">output</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">,</span><span class="n">indices</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">]]</span> <span class="o">=</span> <span class="n">on_value</span>
</pre></div>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>one_hot([1,0,2,0], 3) = [[ 0. 1. 0.]
[ 1. 0. 0.]
[ 0. 0. 1.]
[ 1. 0. 0.]]
one_hot([1,0,2,0], 3, on_value=8, off_value=1,
dtype='int32') = [[1 8 1]
[8 1 1]
[1 1 8]
[8 1 1]]
one_hot([[1,0],[1,0],[2,0]], 3) = [[[ 0. 1. 0.]
[ 1. 0. 0.]]
[[ 0. 1. 0.]
[ 1. 0. 0.]]
[[ 0. 0. 1.]
[ 1. 0. 0.]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/indexing_op.cc:L218</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>indices</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – array of locations where to set on_value</li>
<li><strong>depth</strong> (<em>int, required</em>) – Depth of the one hot dimension.</li>
<li><strong>on_value</strong> (<em>double, optional, default=1</em>) – The value assigned to the locations represented by indices.</li>
<li><strong>off_value</strong> (<em>double, optional, default=0</em>) – The value assigned to the locations not represented by indices.</li>
<li><strong>dtype</strong> (<em>{'float16', 'float32', 'float64', 'int32', 'uint8'},optional, default='float32'</em>) – DType of the output</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.ones_like">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">ones_like</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.ones_like" title="Permalink to this definition"></a></dt>
<dd><p>Return an array of ones with the same shape and type
as the input array.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
<span class="n">ones_like</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
</pre></div>
</div>
<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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.pad">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">pad</code><span class="sig-paren">(</span><em>data=None</em>, <em>mode=_Null</em>, <em>pad_width=_Null</em>, <em>constant_value=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.pad" title="Permalink to this definition"></a></dt>
<dd><p>Pads an input array with a constant or edge values of the array.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>Pad</cite> is deprecated. Use <cite>pad</cite> instead.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Current implementation only supports 4D and 5D input arrays with padding applied
only on axes 1, 2 and 3. Expects axes 4 and 5 in <cite>pad_width</cite> to be zero.</p>
</div>
<p>This operation pads an input array with either a <cite>constant_value</cite> or edge values
along each axis of the input array. The amount of padding is specified by <cite>pad_width</cite>.</p>
<p><cite>pad_width</cite> is a tuple of integer padding widths for each axis of the format
<code class="docutils literal"><span class="pre">(before_1,</span> <span class="pre">after_1,</span> <span class="pre">...</span> <span class="pre">,</span> <span class="pre">before_N,</span> <span class="pre">after_N)</span></code>. The <cite>pad_width</cite> should be of length <code class="docutils literal"><span class="pre">2*N</span></code>
where <code class="docutils literal"><span class="pre">N</span></code> is the number of dimensions of the array.</p>
<p>For dimension <code class="docutils literal"><span class="pre">N</span></code> of the input array, <code class="docutils literal"><span class="pre">before_N</span></code> and <code class="docutils literal"><span class="pre">after_N</span></code> indicates how many values
to add before and after the elements of the array along dimension <code class="docutils literal"><span class="pre">N</span></code>.
The widths of the higher two dimensions <code class="docutils literal"><span class="pre">before_1</span></code>, <code class="docutils literal"><span class="pre">after_1</span></code>, <code class="docutils literal"><span class="pre">before_2</span></code>,
<code class="docutils literal"><span class="pre">after_2</span></code> must be 0.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[[ 1. 2. 3.]
[ 4. 5. 6.]]
[[ 7. 8. 9.]
[ 10. 11. 12.]]]
[[[ 11. 12. 13.]
[ 14. 15. 16.]]
[[ 17. 18. 19.]
[ 20. 21. 22.]]]]
pad(x,mode="edge", pad_width=(0,0,0,0,1,1,1,1)) =
[[[[ 1. 1. 2. 3. 3.]
[ 1. 1. 2. 3. 3.]
[ 4. 4. 5. 6. 6.]
[ 4. 4. 5. 6. 6.]]
[[ 7. 7. 8. 9. 9.]
[ 7. 7. 8. 9. 9.]
[ 10. 10. 11. 12. 12.]
[ 10. 10. 11. 12. 12.]]]
[[[ 11. 11. 12. 13. 13.]
[ 11. 11. 12. 13. 13.]
[ 14. 14. 15. 16. 16.]
[ 14. 14. 15. 16. 16.]]
[[ 17. 17. 18. 19. 19.]
[ 17. 17. 18. 19. 19.]
[ 20. 20. 21. 22. 22.]
[ 20. 20. 21. 22. 22.]]]]
pad(x, mode="constant", constant_value=0, pad_width=(0,0,0,0,1,1,1,1)) =
[[[[ 0. 0. 0. 0. 0.]
[ 0. 1. 2. 3. 0.]
[ 0. 4. 5. 6. 0.]
[ 0. 0. 0. 0. 0.]]
[[ 0. 0. 0. 0. 0.]
[ 0. 7. 8. 9. 0.]
[ 0. 10. 11. 12. 0.]
[ 0. 0. 0. 0. 0.]]]
[[[ 0. 0. 0. 0. 0.]
[ 0. 11. 12. 13. 0.]
[ 0. 14. 15. 16. 0.]
[ 0. 0. 0. 0. 0.]]
[[ 0. 0. 0. 0. 0.]
[ 0. 17. 18. 19. 0.]
[ 0. 20. 21. 22. 0.]
[ 0. 0. 0. 0. 0.]]]]
</pre></div>
</div>
<p>Defined in src/operator/pad.cc:L728</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – An n-dimensional input array.</li>
<li><strong>mode</strong> (<em>{'constant', 'edge', 'reflect'}, required</em>) – Padding type to use. “constant” pads with <cite>constant_value</cite> “edge” pads using the edge values of the input array “reflect” pads by reflecting values with respect to the edges.</li>
<li><strong>pad_width</strong> (<em>Shape(tuple), required</em>) – Widths of the padding regions applied to the edges of each axis. It is a tuple of integer padding widths for each axis of the format <code class="docutils literal"><span class="pre">(before_1,</span> <span class="pre">after_1,</span> <span class="pre">...</span> <span class="pre">,</span> <span class="pre">before_N,</span> <span class="pre">after_N)</span></code>. It should be of length <code class="docutils literal"><span class="pre">2*N</span></code> where <code class="docutils literal"><span class="pre">N</span></code> is the number of dimensions of the array.This is equivalent to pad_width in numpy.pad, but flattened.</li>
<li><strong>constant_value</strong> (<em>double, optional, default=0</em>) – The value used for padding when <cite>mode</cite> is “constant”.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.pick">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">pick</code><span class="sig-paren">(</span><em>data=None</em>, <em>index=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.pick" title="Permalink to this definition"></a></dt>
<dd><p>Picks elements from an input array according to the input indices along the given axis.</p>
<p>Given an input array of shape <code class="docutils literal"><span class="pre">(d0,</span> <span class="pre">d1)</span></code> and indices of shape <code class="docutils literal"><span class="pre">(i0,)</span></code>, the result will be
an output array of shape <code class="docutils literal"><span class="pre">(i0,)</span></code> with:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">output</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="o">=</span> <span class="nb">input</span><span class="p">[</span><span class="n">i</span><span class="p">,</span> <span class="n">indices</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span>
</pre></div>
</div>
<p>By default, if any index mentioned is too large, it is replaced by the index that addresses
the last element along an axis (the <cite>clip</cite> mode).</p>
<p>This function supports n-dimensional input and (n-1)-dimensional indices arrays.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 1., 2.],
[ 3., 4.],
[ 5., 6.]]
// picks elements with specified indices along axis 0
pick(x, y=[0,1], 0) = [ 1., 4.]
// picks elements with specified indices along axis 1
pick(x, y=[0,1,0], 1) = [ 1., 4., 5.]
y = [[ 1.],
[ 0.],
[ 2.]]
// picks elements with specified indices along axis 1 and dims are maintained
pick(x,y, 1, keepdims=True) = [[ 2.],
[ 3.],
[ 6.]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_index.cc:L126</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array</li>
<li><strong>index</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The index array</li>
<li><strong>axis</strong> (<em>int or None, optional, default='None'</em>) – The axis along which to perform the reduction. Negative values means indexing from right to left. <code class="docutils literal"><span class="pre">Requires</span> <span class="pre">axis</span> <span class="pre">to</span> <span class="pre">be</span> <span class="pre">set</span> <span class="pre">as</span> <span class="pre">int,</span> <span class="pre">because</span> <span class="pre">global</span> <span class="pre">reduction</span> <span class="pre">is</span> <span class="pre">not</span> <span class="pre">supported</span> <span class="pre">yet.</span></code></li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axis is left in the result as dimension with size one.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.prod">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">prod</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.prod" title="Permalink to this definition"></a></dt>
<dd><p>Computes the product of array elements over given axes.</p>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L77</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.radians">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">radians</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.radians" title="Permalink to this definition"></a></dt>
<dd><p>Converts each element of the input array from degrees to radians.</p>
<div class="math">
\[radians([0, 90, 180, 270, 360]) = [0, \pi/2, \pi, 3\pi/2, 2\pi]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L567</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.random_exponential">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">random_exponential</code><span class="sig-paren">(</span><em>lam=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.random_exponential" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from an exponential distribution.</p>
<p>Samples are distributed according to an exponential distribution parametrized by <em>lambda</em> (rate).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_exponential</span><span class="p">(</span><span class="n">lam</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.0097189</span> <span class="p">,</span> <span class="mf">0.08999364</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.04146638</span><span class="p">,</span> <span class="mf">0.31715935</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L88</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>lam</strong> (<em>float, optional, default=1</em>) – Lambda parameter (rate) of the exponential distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.random_gamma">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">random_gamma</code><span class="sig-paren">(</span><em>alpha=_Null</em>, <em>beta=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.random_gamma" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a gamma distribution.</p>
<p>Samples are distributed according to a gamma distribution parametrized by <em>alpha</em> (shape) and <em>beta</em> (scale).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_gamma</span><span class="p">(</span><span class="n">alpha</span><span class="o">=</span><span class="mi">9</span><span class="p">,</span> <span class="n">beta</span><span class="o">=</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">7.10486984</span><span class="p">,</span> <span class="mf">3.37695289</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.91697288</span><span class="p">,</span> <span class="mf">3.65933681</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L75</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, optional, default=1</em>) – Alpha parameter (shape) of the gamma distribution.</li>
<li><strong>beta</strong> (<em>float, optional, default=1</em>) – Beta parameter (scale) of the gamma distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.random_generalized_negative_binomial">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">random_generalized_negative_binomial</code><span class="sig-paren">(</span><em>mu=_Null</em>, <em>alpha=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.random_generalized_negative_binomial" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a generalized negative binomial distribution.</p>
<p>Samples are distributed according to a generalized negative binomial distribution parametrized by
<em>mu</em> (mean) and <em>alpha</em> (dispersion). <em>alpha</em> is defined as <em>1/k</em> where <em>k</em> is the failure limit of the
number of unsuccessful experiments (generalized to real numbers).
Samples will always be returned as a floating point data type.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_generalized_negative_binomial</span><span class="p">(</span><span class="n">mu</span><span class="o">=</span><span class="mf">2.0</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">0.3</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L133</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>mu</strong> (<em>float, optional, default=1</em>) – Mean of the negative binomial distribution.</li>
<li><strong>alpha</strong> (<em>float, optional, default=1</em>) – Alpha (dispersion) parameter of the negative binomial distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.random_negative_binomial">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">random_negative_binomial</code><span class="sig-paren">(</span><em>k=_Null</em>, <em>p=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.random_negative_binomial" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a negative binomial distribution.</p>
<p>Samples are distributed according to a negative binomial distribution parametrized by
<em>k</em> (limit of unsuccessful experiments) and <em>p</em> (failure probability in each experiment).
Samples will always be returned as a floating point data type.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_negative_binomial</span><span class="p">(</span><span class="n">k</span><span class="o">=</span><span class="mi">3</span><span class="p">,</span> <span class="n">p</span><span class="o">=</span><span class="mf">0.4</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L117</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>k</strong> (<em>int, optional, default='1'</em>) – Limit of unsuccessful experiments.</li>
<li><strong>p</strong> (<em>float, optional, default=1</em>) – Failure probability in each experiment.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.random_normal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">random_normal</code><span class="sig-paren">(</span><em>loc=_Null</em>, <em>scale=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.random_normal" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a normal (Gaussian) distribution.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The existing alias <code class="docutils literal"><span class="pre">normal</span></code> is deprecated.</p>
</div>
<p>Samples are distributed according to a normal distribution parametrized by <em>loc</em> (mean) and <em>scale</em> (standard deviation).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_normal</span><span class="p">(</span><span class="n">loc</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">scale</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.89171135</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.16881478</span><span class="p">],</span>
<span class="p">[</span><span class="o">-</span><span class="mf">1.23474145</span><span class="p">,</span> <span class="mf">1.55807114</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L62</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>loc</strong> (<em>float, optional, default=0</em>) – Mean of the distribution.</li>
<li><strong>scale</strong> (<em>float, optional, default=1</em>) – Standard deviation of the distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.random_poisson">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">random_poisson</code><span class="sig-paren">(</span><em>lam=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.random_poisson" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a Poisson distribution.</p>
<p>Samples are distributed according to a Poisson distribution parametrized by <em>lambda</em> (rate).
Samples will always be returned as a floating point data type.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_poisson</span><span class="p">(</span><span class="n">lam</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L102</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>lam</strong> (<em>float, optional, default=1</em>) – Lambda parameter (rate) of the Poisson distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.random_uniform">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">random_uniform</code><span class="sig-paren">(</span><em>low=_Null</em>, <em>high=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.random_uniform" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a uniform distribution.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The existing alias <code class="docutils literal"><span class="pre">uniform</span></code> is deprecated.</p>
</div>
<p>Samples are uniformly distributed over the half-open interval <em>[low, high)</em>
(includes <em>low</em>, but excludes <em>high</em>).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_uniform</span><span class="p">(</span><span class="n">low</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.60276335</span><span class="p">,</span> <span class="mf">0.85794562</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.54488319</span><span class="p">,</span> <span class="mf">0.84725171</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L45</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, optional, default=0</em>) – Lower bound of the distribution.</li>
<li><strong>high</strong> (<em>float, optional, default=1</em>) – Upper bound of the distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.relu">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">relu</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.relu" title="Permalink to this definition"></a></dt>
<dd><p>Computes rectified linear.</p>
<div class="math">
\[max(features, 0)\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L18</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.repeat">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">repeat</code><span class="sig-paren">(</span><em>data=None</em>, <em>repeats=_Null</em>, <em>axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.repeat" title="Permalink to this definition"></a></dt>
<dd><p>Repeats elements of an array.</p>
<p>By default, <code class="docutils literal"><span class="pre">repeat</span></code> flattens the input array into 1-D and then repeats the
elements:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span>
<span class="p">[</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]]</span>
<span class="n">repeat</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">repeats</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]</span>
</pre></div>
</div>
<p>The parameter <code class="docutils literal"><span class="pre">axis</span></code> specifies the axis along which to perform repeat:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">repeat</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">repeats</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
<span class="n">repeat</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">repeats</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
<span class="n">repeat</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">repeats</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">axis</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L498</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data array</li>
<li><strong>repeats</strong> (<em>int, required</em>) – The number of repetitions for each element.</li>
<li><strong>axis</strong> (<em>int or None, optional, default='None'</em>) – The axis along which to repeat values. The negative numbers are interpreted counting from the backward. By default, use the flattened input array, and return a flat output array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.reshape">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">reshape</code><span class="sig-paren">(</span><em>data=None</em>, <em>shape=_Null</em>, <em>reverse=_Null</em>, <em>target_shape=_Null</em>, <em>keep_highest=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.reshape" title="Permalink to this definition"></a></dt>
<dd><p>Reshapes the input array.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">Reshape</span></code> is deprecated, use <code class="docutils literal"><span class="pre">reshape</span></code></p>
</div>
<p>Given an array and a shape, this function returns a copy of the array in the new shape.
The shape is a tuple of integers such as (2,3,4).The size of the new shape should be same as the size of the input array.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">reshape</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">],</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span><span class="mi">4</span><span class="p">]]</span>
</pre></div>
</div>
<p>Some dimensions of the shape can take special values from the set {0, -1, -2, -3, -4}. The significance of each is explained below:</p>
<ul>
<li><p class="first"><code class="docutils literal"><span class="pre">0</span></code> copy this dimension from the input to the output shape.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (4,0,2), output shape = (4,3,2)
- input shape = (2,3,4), shape = (2,0,0), output shape = (2,3,4)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-1</span></code> infers the dimension of the output shape by using the remainder of the input dimensions
keeping the size of the new array same as that of the input array.
At most one dimension of shape can be -1.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (6,1,-1), output shape = (6,1,4)
- input shape = (2,3,4), shape = (3,-1,8), output shape = (3,1,8)
- input shape = (2,3,4), shape=(-1,), output shape = (24,)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-2</span></code> copy all/remainder of the input dimensions to the output shape.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (-2,), output shape = (2,3,4)
- input shape = (2,3,4), shape = (2,-2), output shape = (2,3,4)
- input shape = (2,3,4), shape = (-2,1,1), output shape = (2,3,4,1,1)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-3</span></code> use the product of two consecutive dimensions of the input shape as the output dimension.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (-3,4), output shape = (6,4)
- input shape = (2,3,4,5), shape = (-3,-3), output shape = (6,20)
- input shape = (2,3,4), shape = (0,-3), output shape = (2,12)
- input shape = (2,3,4), shape = (-3,-2), output shape = (6,4)
</pre></div>
</div>
</li>
<li><p class="first"><code class="docutils literal"><span class="pre">-4</span></code> split one dimension of the input into two dimensions passed subsequent to -4 in shape (can contain -1).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- input shape = (2,3,4), shape = (-4,1,2,-2), output shape =(1,2,3,4)
- input shape = (2,3,4), shape = (2,-4,-1,3,-2), output shape = (2,1,3,4)
</pre></div>
</div>
</li>
</ul>
<p>If the argument <cite>reverse</cite> is set to 1, then the special values are inferred from right to left.</p>
<blockquote>
<div><p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>- without reverse=1, for input shape = (10,5,4), shape = (-1,0), output shape would be (40,5)
- with reverse=1, output shape will be (50,4).
</pre></div>
</div>
</div></blockquote>
<p>Defined in src/operator/tensor/matrix_op.cc:L87</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to reshape.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – The target shape</li>
<li><strong>reverse</strong> (<em>boolean, optional, default=False</em>) – If true then the special values are inferred from right to left</li>
<li><strong>target_shape</strong> (<em>Shape(tuple), optional, default=(0,0)</em>) – (Deprecated! Use <code class="docutils literal"><span class="pre">shape</span></code> instead.) Target new shape. One and only one dim can be 0, in which case it will be inferred from the rest of dims</li>
<li><strong>keep_highest</strong> (<em>boolean, optional, default=False</em>) – (Deprecated! Use <code class="docutils literal"><span class="pre">shape</span></code> instead.) Whether keep the highest dim unchanged.If set to true, then the first dim in target_shape is ignored,and always fixed as input</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.reverse">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">reverse</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.reverse" title="Permalink to this definition"></a></dt>
<dd><p>Reverses the order of elements along given axis while preserving array shape.</p>
<p>Note: reverse and flip are equivalent. We use reverse in the following examples.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">]]</span>
<span class="n">reverse</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">9.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
<span class="n">reverse</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">9.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L600</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data array</li>
<li><strong>axis</strong> (<em>Shape(tuple), required</em>) – The axis which to reverse elements.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.rint">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">rint</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.rint" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise rounded value to the nearest integer of the input.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<ul class="last simple">
<li>For input <code class="docutils literal"><span class="pre">n.5</span></code> <code class="docutils literal"><span class="pre">rint</span></code> returns <code class="docutils literal"><span class="pre">n</span></code> while <code class="docutils literal"><span class="pre">round</span></code> returns <code class="docutils literal"><span class="pre">n+1</span></code>.</li>
<li>For input <code class="docutils literal"><span class="pre">-n.5</span></code> both <code class="docutils literal"><span class="pre">rint</span></code> and <code class="docutils literal"><span class="pre">round</span></code> returns <code class="docutils literal"><span class="pre">-n-1</span></code>.</li>
</ul>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">rint</span><span class="p">([</span><span class="o">-</span><span class="mf">1.5</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.9</span><span class="p">,</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mf">2.1</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L264</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.rmsprop_update">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">rmsprop_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>n=None</em>, <em>lr=_Null</em>, <em>gamma1=_Null</em>, <em>epsilon=_Null</em>, <em>wd=_Null</em>, <em>rescale_grad=_Null</em>, <em>clip_gradient=_Null</em>, <em>clip_weights=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.rmsprop_update" title="Permalink to this definition"></a></dt>
<dd><p>Update function for <cite>RMSProp</cite> optimizer.</p>
<p><cite>RMSprop</cite> is a variant of stochastic gradient descent where the gradients are
divided by a cache which grows with the sum of squares of recent gradients?</p>
<p><cite>RMSProp</cite> is similar to <cite>AdaGrad</cite>, a popular variant of <cite>SGD</cite> which adaptively
tunes the learning rate of each parameter. <cite>AdaGrad</cite> lowers the learning rate for
each parameter monotonically over the course of training.
While this is analytically motivated for convex optimizations, it may not be ideal
for non-convex problems. <cite>RMSProp</cite> deals with this heuristically by allowing the
learning rates to rebound as the denominator decays over time.</p>
<p>Define the Root Mean Square (RMS) error criterion of the gradient as
<span class="math">\(RMS[g]_t = \sqrt{E[g^2]_t + \epsilon}\)</span>, where <span class="math">\(g\)</span> represents
gradient and <span class="math">\(E[g^2]_t\)</span> is the decaying average over past squared gradient.</p>
<p>The <span class="math">\(E[g^2]_t\)</span> is given by:</p>
<div class="math">
\[E[g^2]_t = \gamma * E[g^2]_{t-1} + (1-\gamma) * g_t^2\]</div>
<p>The update step is</p>
<div class="math">
\[\theta_{t+1} = \theta_t - \frac{\eta}{RMS[g]_t} g_t\]</div>
<p>The RMSProp code follows the version in
<a class="reference external" href="http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf">http://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf</a>
Tieleman &amp; Hinton, 2012.</p>
<p>Hinton suggests the momentum term <span class="math">\(\gamma\)</span> to be 0.9 and the learning rate
<span class="math">\(\eta\)</span> to be 0.001.</p>
<p>Defined in src/operator/optimizer_op.cc:L178</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>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>n</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – n</li>
<li><strong>lr</strong> (<em>float, required</em>) – Learning rate</li>
<li><strong>gamma1</strong> (<em>float, optional, default=0.95</em>) – The decay rate of momentum estimates.</li>
<li><strong>epsilon</strong> (<em>float, optional, default=1e-08</em>) – A small constant for numerical stability.</li>
<li><strong>wd</strong> (<em>float, optional, default=0</em>) – Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.</li>
<li><strong>rescale_grad</strong> (<em>float, optional, default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float, optional, default=-1</em>) – Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).</li>
<li><strong>clip_weights</strong> (<em>float, optional, default=-1</em>) – Clip weights to the range of [-clip_weights, clip_weights] If clip_weights <= 0, weight clipping is turned off. weights = max(min(weights, clip_weights), -clip_weights).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.rmspropalex_update">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">rmspropalex_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>n=None</em>, <em>g=None</em>, <em>delta=None</em>, <em>lr=_Null</em>, <em>gamma1=_Null</em>, <em>gamma2=_Null</em>, <em>epsilon=_Null</em>, <em>wd=_Null</em>, <em>rescale_grad=_Null</em>, <em>clip_gradient=_Null</em>, <em>clip_weights=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.rmspropalex_update" title="Permalink to this definition"></a></dt>
<dd><p>Update function for RMSPropAlex optimizer.</p>
<p><cite>RMSPropAlex</cite> is non-centered version of <cite>RMSProp</cite>.</p>
<p>Define <span class="math">\(E[g^2]_t\)</span> is the decaying average over past squared gradient and
<span class="math">\(E[g]_t\)</span> is the decaying average over past gradient.</p>
<div class="math">
\[\begin{split}E[g^2]_t = \gamma_1 * E[g^2]_{t-1} + (1 - \gamma_1) * g_t^2\\
E[g]_t = \gamma_1 * E[g]_{t-1} + (1 - \gamma_1) * g_t\\
\Delta_t = \gamma_2 * \Delta_{t-1} - \frac{\eta}{\sqrt{E[g^2]_t - E[g]_t^2 + \epsilon}} g_t\\\end{split}\]</div>
<p>The update step is</p>
<div class="math">
\[\theta_{t+1} = \theta_t + \Delta_t\]</div>
<p>The RMSPropAlex code follows the version in
<a class="reference external" href="http://arxiv.org/pdf/1308.0850v5.pdf">http://arxiv.org/pdf/1308.0850v5.pdf</a> Eq(38) - Eq(45) by Alex Graves, 2013.</p>
<p>Graves suggests the momentum term <span class="math">\(\gamma_1\)</span> to be 0.95, <span class="math">\(\gamma_2\)</span>
to be 0.9 and the learning rate <span class="math">\(\eta\)</span> to be 0.0001.</p>
<p>Defined in src/operator/optimizer_op.cc:L217</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>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>n</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – n</li>
<li><strong>g</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – g</li>
<li><strong>delta</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – delta</li>
<li><strong>lr</strong> (<em>float, required</em>) – Learning rate</li>
<li><strong>gamma1</strong> (<em>float, optional, default=0.95</em>) – Decay rate.</li>
<li><strong>gamma2</strong> (<em>float, optional, default=0.9</em>) – Decay rate.</li>
<li><strong>epsilon</strong> (<em>float, optional, default=1e-08</em>) – A small constant for numerical stability.</li>
<li><strong>wd</strong> (<em>float, optional, default=0</em>) – Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.</li>
<li><strong>rescale_grad</strong> (<em>float, optional, default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float, optional, default=-1</em>) – Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).</li>
<li><strong>clip_weights</strong> (<em>float, optional, default=-1</em>) – Clip weights to the range of [-clip_weights, clip_weights] If clip_weights <= 0, weight clipping is turned off. weights = max(min(weights, clip_weights), -clip_weights).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.round">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">round</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.round" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise rounded value to the nearest integer of the input.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="nb">round</span><span class="p">([</span><span class="o">-</span><span class="mf">1.5</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.9</span><span class="p">,</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mf">2.1</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L248</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.rsqrt">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">rsqrt</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.rsqrt" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise inverse square-root value of the input.</p>
<div class="math">
\[rsqrt(x) = 1/\sqrt{x}\]</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">rsqrt</span><span class="p">([</span><span class="mi">4</span><span class="p">,</span><span class="mi">9</span><span class="p">,</span><span class="mi">16</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.33333334</span><span class="p">,</span> <span class="mf">0.25</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L365</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_exponential">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_exponential</code><span class="sig-paren">(</span><em>lam=None</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_exponential" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple
exponential distributions with parameters lambda (rate).</p>
<p>The parameters of the distributions are provided as an input array.
Let <em>[s]</em> be the shape of the input array, <em>n</em> be the dimension of <em>[s]</em>, <em>[t]</em>
be the shape specified as the parameter of the operator, and <em>m</em> be the dimension
of <em>[t]</em>. Then the output will be a <em>(n+m)</em>-dimensional array with shape <em>[s]x[t]</em>.</p>
<p>For any valid <em>n</em>-dimensional index <em>i</em> with respect to the input array, <em>output[i]</em>
will be an <em>m</em>-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input value at index <em>i</em>. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input array.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>lam = [ 1.0, 8.5 ]
// Draw a single sample for each distribution
sample_exponential(lam) = [ 0.51837951, 0.09994757]
// Draw a vector containing two samples for each distribution
sample_exponential(lam, shape=(2)) = [[ 0.51837951, 0.19866663],
[ 0.09994757, 0.50447971]]
</pre></div>
</div>
<p>Defined in src/operator/random/multisample_op.cc:L370</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>lam</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Lambda (rate) parameters of the distributions.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_gamma">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_gamma</code><span class="sig-paren">(</span><em>alpha=None</em>, <em>beta=None</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_gamma" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple
gamma distributions with parameters <em>alpha</em> (shape) and <em>beta</em> (scale).</p>
<p>The parameters of the distributions are provided as input arrays.
Let <em>[s]</em> be the shape of the input arrays, <em>n</em> be the dimension of <em>[s]</em>, <em>[t]</em>
be the shape specified as the parameter of the operator, and <em>m</em> be the dimension
of <em>[t]</em>. Then the output will be a <em>(n+m)</em>-dimensional array with shape <em>[s]x[t]</em>.</p>
<p>For any valid <em>n</em>-dimensional index <em>i</em> with respect to the input arrays, <em>output[i]</em>
will be an <em>m</em>-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index <em>i</em>. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>alpha = [ 0.0, 2.5 ]
beta = [ 1.0, 0.7 ]
// Draw a single sample for each distribution
sample_gamma(alpha, beta) = [ 0. , 2.25797319]
// Draw a vector containing two samples for each distribution
sample_gamma(alpha, beta, shape=(2)) = [[ 0. , 0. ],
[ 2.25797319, 1.70734084]]
</pre></div>
</div>
<p>Defined in src/operator/random/multisample_op.cc:L368</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> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Alpha (shape) parameters of the distributions.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>beta</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Beta (scale) parameters of the distributions.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_generalized_negative_binomial">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_generalized_negative_binomial</code><span class="sig-paren">(</span><em>mu=None</em>, <em>alpha=None</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_generalized_negative_binomial" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple
generalized negative binomial distributions with parameters <em>mu</em> (mean) and <em>alpha</em> (dispersion).</p>
<p>The parameters of the distributions are provided as input arrays.
Let <em>[s]</em> be the shape of the input arrays, <em>n</em> be the dimension of <em>[s]</em>, <em>[t]</em>
be the shape specified as the parameter of the operator, and <em>m</em> be the dimension
of <em>[t]</em>. Then the output will be a <em>(n+m)</em>-dimensional array with shape <em>[s]x[t]</em>.</p>
<p>For any valid <em>n</em>-dimensional index <em>i</em> with respect to the input arrays, <em>output[i]</em>
will be an <em>m</em>-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index <em>i</em>. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.</p>
<p>Samples will always be returned as a floating point data type.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>mu = [ 2.0, 2.5 ]
alpha = [ 1.0, 0.1 ]
// Draw a single sample for each distribution
sample_generalized_negative_binomial(mu, alpha) = [ 0., 3.]
// Draw a vector containing two samples for each distribution
sample_generalized_negative_binomial(mu, alpha, shape=(2)) = [[ 0., 3.],
[ 3., 1.]]
</pre></div>
</div>
<p>Defined in src/operator/random/multisample_op.cc:L379</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>mu</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Means of the distributions.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>alpha</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Alpha (dispersion) parameters of the distributions.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_multinomial">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_multinomial</code><span class="sig-paren">(</span><em>data=None</em>, <em>shape=_Null</em>, <em>get_prob=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_multinomial" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple multinomial distributions.</p>
<p><em>data</em> is an <em>n</em> dimensional array whose last dimension has length <em>k</em>, where
<em>k</em> is the number of possible outcomes of each multinomial distribution. This
operator will draw <em>shape</em> samples from each distribution. If shape is empty
one sample will be drawn from each distribution.</p>
<p>If <em>get_prob</em> is true, a second array containing log likelihood of the drawn
samples will also be returned. This is usually used for reinforcement learning
where you can provide reward as head gradient for this array to estimate
gradient.</p>
<p>Note that the input distribution must be normalized, i.e. <em>data</em> must sum to
1 along its last axis.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>probs = [[0, 0.1, 0.2, 0.3, 0.4], [0.4, 0.3, 0.2, 0.1, 0]]
// Draw a single sample for each distribution
sample_multinomial(probs) = [3, 0]
// Draw a vector containing two samples for each distribution
sample_multinomial(probs, shape=(2)) = [[4, 2],
[0, 0]]
// requests log likelihood
sample_multinomial(probs, get_prob=True) = [2, 1], [0.2, 0.3]
</pre></div>
</div>
<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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Distribution probabilities. Must sum to one on the last axis.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>get_prob</strong> (<em>boolean, optional, default=False</em>) – Whether to also return the log probability of sampled result. This is usually used for differentiating through stochastic variables, e.g. in reinforcement learning.</li>
<li><strong>dtype</strong> (<em>{'int32'},optional, default='int32'</em>) – DType of the output in case this can’t be inferred. Only support int32 for now.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_negative_binomial">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_negative_binomial</code><span class="sig-paren">(</span><em>k=None</em>, <em>p=None</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_negative_binomial" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple
negative binomial distributions with parameters <em>k</em> (failure limit) and <em>p</em> (failure probability).</p>
<p>The parameters of the distributions are provided as input arrays.
Let <em>[s]</em> be the shape of the input arrays, <em>n</em> be the dimension of <em>[s]</em>, <em>[t]</em>
be the shape specified as the parameter of the operator, and <em>m</em> be the dimension
of <em>[t]</em>. Then the output will be a <em>(n+m)</em>-dimensional array with shape <em>[s]x[t]</em>.</p>
<p>For any valid <em>n</em>-dimensional index <em>i</em> with respect to the input arrays, <em>output[i]</em>
will be an <em>m</em>-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index <em>i</em>. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.</p>
<p>Samples will always be returned as a floating point data type.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>k = [ 20, 49 ]
p = [ 0.4 , 0.77 ]
// Draw a single sample for each distribution
sample_negative_binomial(k, p) = [ 15., 16.]
// Draw a vector containing two samples for each distribution
sample_negative_binomial(k, p, shape=(2)) = [[ 15., 50.],
[ 16., 12.]]
</pre></div>
</div>
<p>Defined in src/operator/random/multisample_op.cc:L375</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>k</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Limits of unsuccessful experiments.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>p</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Failure probabilities in each experiment.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_normal">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_normal</code><span class="sig-paren">(</span><em>mu=None</em>, <em>sigma=None</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_normal" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple
normal distributions with parameters <em>mu</em> (mean) and <em>sigma</em> (standard deviation).</p>
<p>The parameters of the distributions are provided as input arrays.
Let <em>[s]</em> be the shape of the input arrays, <em>n</em> be the dimension of <em>[s]</em>, <em>[t]</em>
be the shape specified as the parameter of the operator, and <em>m</em> be the dimension
of <em>[t]</em>. Then the output will be a <em>(n+m)</em>-dimensional array with shape <em>[s]x[t]</em>.</p>
<p>For any valid <em>n</em>-dimensional index <em>i</em> with respect to the input arrays, <em>output[i]</em>
will be an <em>m</em>-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index <em>i</em>. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>mu = [ 0.0, 2.5 ]
sigma = [ 1.0, 3.7 ]
// Draw a single sample for each distribution
sample_normal(mu, sigma) = [-0.56410581, 0.95934606]
// Draw a vector containing two samples for each distribution
sample_normal(mu, sigma, shape=(2)) = [[-0.56410581, 0.2928229 ],
[ 0.95934606, 4.48287058]]
</pre></div>
</div>
<p>Defined in src/operator/random/multisample_op.cc:L365</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>mu</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Means of the distributions.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>sigma</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Standard deviations of the distributions.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_poisson">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_poisson</code><span class="sig-paren">(</span><em>lam=None</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_poisson" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple
Poisson distributions with parameters lambda (rate).</p>
<p>The parameters of the distributions are provided as an input array.
Let <em>[s]</em> be the shape of the input array, <em>n</em> be the dimension of <em>[s]</em>, <em>[t]</em>
be the shape specified as the parameter of the operator, and <em>m</em> be the dimension
of <em>[t]</em>. Then the output will be a <em>(n+m)</em>-dimensional array with shape <em>[s]x[t]</em>.</p>
<p>For any valid <em>n</em>-dimensional index <em>i</em> with respect to the input array, <em>output[i]</em>
will be an <em>m</em>-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input value at index <em>i</em>. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input array.</p>
<p>Samples will always be returned as a floating point data type.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>lam = [ 1.0, 8.5 ]
// Draw a single sample for each distribution
sample_poisson(lam) = [ 0., 13.]
// Draw a vector containing two samples for each distribution
sample_poisson(lam, shape=(2)) = [[ 0., 4.],
[ 13., 8.]]
</pre></div>
</div>
<p>Defined in src/operator/random/multisample_op.cc:L372</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>lam</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Lambda (rate) parameters of the distributions.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sample_uniform">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sample_uniform</code><span class="sig-paren">(</span><em>low=None</em>, <em>high=None</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sample_uniform" title="Permalink to this definition"></a></dt>
<dd><p>Concurrent sampling from multiple
uniform distributions on the intervals given by <em>[low,high)</em>.</p>
<p>The parameters of the distributions are provided as input arrays.
Let <em>[s]</em> be the shape of the input arrays, <em>n</em> be the dimension of <em>[s]</em>, <em>[t]</em>
be the shape specified as the parameter of the operator, and <em>m</em> be the dimension
of <em>[t]</em>. Then the output will be a <em>(n+m)</em>-dimensional array with shape <em>[s]x[t]</em>.</p>
<p>For any valid <em>n</em>-dimensional index <em>i</em> with respect to the input arrays, <em>output[i]</em>
will be an <em>m</em>-dimensional array that holds randomly drawn samples from the distribution
which is parameterized by the input values at index <em>i</em>. If the shape parameter of the
operator is not set, then one sample will be drawn per distribution and the output array
has the same shape as the input arrays.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>low = [ 0.0, 2.5 ]
high = [ 1.0, 3.7 ]
// Draw a single sample for each distribution
sample_uniform(low, high) = [ 0.40451524, 3.18687344]
// Draw a vector containing two samples for each distribution
sample_uniform(low, high, shape=(2)) = [[ 0.40451524, 0.18017688],
[ 3.18687344, 3.68352246]]
</pre></div>
</div>
<p>Defined in src/operator/random/multisample_op.cc:L363</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> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Lower bounds of the distributions.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape to be sampled from each random distribution.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>high</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Upper bounds of the distributions.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sgd_mom_update">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sgd_mom_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>mom=None</em>, <em>lr=_Null</em>, <em>momentum=_Null</em>, <em>wd=_Null</em>, <em>rescale_grad=_Null</em>, <em>clip_gradient=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sgd_mom_update" title="Permalink to this definition"></a></dt>
<dd><p>Momentum update function for Stochastic Gradient Descent (SDG) optimizer.</p>
<p>Momentum update has better convergence rates on neural networks. Mathematically it looks
like below:</p>
<div class="math">
\[\begin{split}v_1 = \alpha * \nabla J(W_0)\\
v_t = \gamma v_{t-1} - \alpha * \nabla J(W_{t-1})\\
W_t = W_{t-1} + v_t\end{split}\]</div>
<p>It updates the weights using:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">v</span> <span class="o">=</span> <span class="n">momentum</span> <span class="o">*</span> <span class="n">v</span> <span class="o">-</span> <span class="n">learning_rate</span> <span class="o">*</span> <span class="n">gradient</span>
<span class="n">weight</span> <span class="o">+=</span> <span class="n">v</span>
</pre></div>
</div>
<p>Where the parameter <code class="docutils literal"><span class="pre">momentum</span></code> is the decay rate of momentum estimates at each epoch.</p>
<p>Defined in src/operator/optimizer_op.cc:L55</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>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>mom</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Momentum</li>
<li><strong>lr</strong> (<em>float, required</em>) – Learning rate</li>
<li><strong>momentum</strong> (<em>float, optional, default=0</em>) – The decay rate of momentum estimates at each epoch.</li>
<li><strong>wd</strong> (<em>float, optional, default=0</em>) – Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.</li>
<li><strong>rescale_grad</strong> (<em>float, optional, default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float, optional, default=-1</em>) – Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sgd_update">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sgd_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>lr=_Null</em>, <em>wd=_Null</em>, <em>rescale_grad=_Null</em>, <em>clip_gradient=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sgd_update" title="Permalink to this definition"></a></dt>
<dd><p>Update function for Stochastic Gradient Descent (SDG) optimizer.</p>
<p>It updates the weights using:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">weight</span> <span class="o">=</span> <span class="n">weight</span> <span class="o">-</span> <span class="n">learning_rate</span> <span class="o">*</span> <span class="n">gradient</span>
</pre></div>
</div>
<p>Defined in src/operator/optimizer_op.cc:L25</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>weight</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>lr</strong> (<em>float, required</em>) – Learning rate</li>
<li><strong>wd</strong> (<em>float, optional, default=0</em>) – Weight decay augments the objective function with a regularization term that penalizes large weights. The penalty scales with the square of the magnitude of each weight.</li>
<li><strong>rescale_grad</strong> (<em>float, optional, default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float, optional, default=-1</em>) – Clip gradient to the range of [-clip_gradient, clip_gradient] If clip_gradient <= 0, gradient clipping is turned off. grad = max(min(grad, clip_gradient), -clip_gradient).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sigmoid">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sigmoid</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sigmoid" title="Permalink to this definition"></a></dt>
<dd><p>Computes sigmoid of x element-wise.</p>
<div class="math">
\[y = 1 / (1 + exp(-x))\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L36</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sign">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sign</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sign" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise sign of the input.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">sign</span><span class="p">([</span><span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L233</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sin">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sin</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sin" title="Permalink to this definition"></a></dt>
<dd><p>Computes the element-wise sine of the input array.</p>
<p>The input should be in radians (<span class="math">\(2\pi\)</span> rad equals 360 degrees).</p>
<div class="math">
\[sin([0, \pi/4, \pi/2]) = [0, 0.707, 1]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L430</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sinh">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sinh</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sinh" title="Permalink to this definition"></a></dt>
<dd><p>Returns the hyperbolic sine of the input array, computed element-wise.</p>
<div class="math">
\[sinh(x) = 0.5\times(exp(x) - exp(-x))\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L581</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.slice">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">slice</code><span class="sig-paren">(</span><em>data=None</em>, <em>begin=_Null</em>, <em>end=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.slice" title="Permalink to this definition"></a></dt>
<dd><p>Slices a contiguous region of the array.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">crop</span></code> is deprecated. Use <code class="docutils literal"><span class="pre">slice</span></code> instead.</p>
</div>
<p>This function returns a sliced continuous region of the array between the indices given
by <cite>begin</cite> and <cite>end</cite>.</p>
<p>For an input array of <cite>n</cite> dimensions, slice operation with <code class="docutils literal"><span class="pre">begin=(b_0,</span> <span class="pre">b_1...b_n-1)</span></code> indices
and <code class="docutils literal"><span class="pre">end=(e_1,</span> <span class="pre">e_2,</span> <span class="pre">...</span> <span class="pre">e_n)</span></code> indices will result in an array with the shape
<code class="docutils literal"><span class="pre">(e_1-b_0,</span> <span class="pre">...,</span> <span class="pre">e_n-b_n-1)</span></code>.</p>
<p>The resulting array’s <em>k</em>-th dimension contains elements
from the <em>k</em>-th dimension of the input array with the open range <code class="docutils literal"><span class="pre">[b_k,</span> <span class="pre">e_k)</span></code>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">9.</span><span class="p">,</span> <span class="mf">10.</span><span class="p">,</span> <span class="mf">11.</span><span class="p">,</span> <span class="mf">12.</span><span class="p">]]</span>
<span class="nb">slice</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">begin</span><span class="o">=</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="n">end</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">4</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L256</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Source input</li>
<li><strong>begin</strong> (<em>Shape(tuple), required</em>) – starting indices for the slice operation, supports negative indices.</li>
<li><strong>end</strong> (<em>Shape(tuple), required</em>) – ending indices for the slice operation, supports negative indices.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.slice_axis">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">slice_axis</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>begin=_Null</em>, <em>end=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.slice_axis" title="Permalink to this definition"></a></dt>
<dd><p>Slices along a given axis.</p>
<p>Returns an array slice along a given <cite>axis</cite> starting from the <cite>begin</cite> index
to the <cite>end</cite> index.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">9.</span><span class="p">,</span> <span class="mf">10.</span><span class="p">,</span> <span class="mf">11.</span><span class="p">,</span> <span class="mf">12.</span><span class="p">]]</span>
<span class="n">slice_axis</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">begin</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">end</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">9.</span><span class="p">,</span> <span class="mf">10.</span><span class="p">,</span> <span class="mf">11.</span><span class="p">,</span> <span class="mf">12.</span><span class="p">]]</span>
<span class="n">slice_axis</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">begin</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">end</span><span class="o">=</span><span class="mi">2</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">9.</span><span class="p">,</span> <span class="mf">10.</span><span class="p">]]</span>
<span class="n">slice_axis</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">begin</span><span class="o">=-</span><span class="mi">3</span><span class="p">,</span> <span class="n">end</span><span class="o">=-</span><span class="mi">1</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">6.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">10.</span><span class="p">,</span> <span class="mf">11.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L336</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Source input</li>
<li><strong>axis</strong> (<em>int, required</em>) – Axis along which to be sliced, supports negative indexes.</li>
<li><strong>begin</strong> (<em>int, required</em>) – The beginning index along the axis to be sliced, supports negative indexes.</li>
<li><strong>end</strong> (<em>int or None, required</em>) – The ending index along the axis to be sliced, supports negative indexes.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.smooth_l1">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">smooth_l1</code><span class="sig-paren">(</span><em>data=None</em>, <em>scalar=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.smooth_l1" title="Permalink to this definition"></a></dt>
<dd><p>Calculate Smooth L1 Loss(lhs, scalar) by summing</p>
<div class="math">
\[\begin{split}f(x) =
\begin{cases}
(\sigma x)^2/2,&amp; \text{if }x < 1/\sigma^2\\
|x|-0.5/\sigma^2,&amp; \text{otherwise}
\end{cases}\end{split}\]</div>
<p>where <span class="math">\(x\)</span> is an element of the tensor <em>lhs</em> and <span class="math">\(\sigma\)</span> is the scalar.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">smooth_l1</span><span class="p">([</span><span class="mi">1</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="mi">4</span><span class="p">],</span> <span class="n">sigma</span><span class="o">=</span><span class="mi">1</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mf">2.5</span><span class="p">,</span> <span class="mf">3.5</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_binary_scalar_op_extended.cc:L79</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – source input</li>
<li><strong>scalar</strong> (<em>float</em>) – scalar input</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.softmax">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">softmax</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.softmax" title="Permalink to this definition"></a></dt>
<dd><p>Applies the softmax function.</p>
<p>The resulting array contains elements in the range (0,1) and the elements along the given axis sum up to 1.</p>
<div class="math">
\[softmax(\mathbf{z})_j = \frac{e^{z_j}}{\sum_{k=1}^K e^{z_k}}\]</div>
<p>for <span class="math">\(j = 1, ..., K\)</span></p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 1. 1. 1.]
[ 1. 1. 1.]]
softmax(x,axis=0) = [[ 0.5 0.5 0.5]
[ 0.5 0.5 0.5]]
softmax(x,axis=1) = [[ 0.33333334, 0.33333334, 0.33333334],
[ 0.33333334, 0.33333334, 0.33333334]]
</pre></div>
</div>
<p>Defined in src/operator/nn/softmax.cc:L35</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>axis</strong> (<em>int, optional, default='-1'</em>) – The axis along which to compute softmax.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.softmax_cross_entropy">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">softmax_cross_entropy</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.softmax_cross_entropy" title="Permalink to this definition"></a></dt>
<dd><p>Calculate cross entropy of softmax output and one-hot label.</p>
<ul>
<li><p class="first">This operator computes the cross entropy in two steps:
- Applies softmax function on the input array.
- Computes and returns the cross entropy loss between the softmax output and the labels.</p>
</li>
<li><p class="first">The softmax function and cross entropy loss is given by:</p>
<ul class="simple">
<li>Softmax Function:</li>
</ul>
<div class="math">
\[\text{softmax}(x)_i = \frac{exp(x_i)}{\sum_j exp(x_j)}\]</div>
<ul class="simple">
<li>Cross Entropy Function:</li>
</ul>
<div class="math">
\[\text{CE(label, output)} = - \sum_i \text{label}_i \log(\text{output}_i)\]</div>
</li>
</ul>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span><span class="mi">1</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="p">[</span><span class="mi">11</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">5</span><span class="p">]]</span>
<span class="n">label</span> <span class="o">=</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span>
<span class="n">softmax</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span><span class="mf">0.09003057</span><span class="p">,</span> <span class="mf">0.24472848</span><span class="p">,</span> <span class="mf">0.66524094</span><span class="p">],</span>
<span class="p">[</span><span class="mf">0.97962922</span><span class="p">,</span> <span class="mf">0.01794253</span><span class="p">,</span> <span class="mf">0.00242826</span><span class="p">]]</span>
<span class="n">softmax_cross_entropy</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">label</span><span class="p">)</span> <span class="o">=</span> <span class="o">-</span> <span class="n">log</span><span class="p">(</span><span class="mf">0.66524084</span><span class="p">)</span> <span class="o">-</span> <span class="n">log</span><span class="p">(</span><span class="mf">0.97962922</span><span class="p">)</span> <span class="o">=</span> <span class="mf">0.4281871</span>
</pre></div>
</div>
<p>Defined in src/operator/loss_binary_op.cc:L40</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data</li>
<li><strong>label</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input label</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sort">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sort</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>is_ascend=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sort" title="Permalink to this definition"></a></dt>
<dd><p>Returns a sorted copy of an input array along the given axis.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 1, 4],
[ 3, 1]]
// sorts along the last axis
sort(x) = [[ 1., 4.],
[ 1., 3.]]
// flattens and then sorts
sort(x) = [ 1., 1., 3., 4.]
// sorts along the first axis
sort(x, axis=0) = [[ 1., 1.],
[ 3., 4.]]
// in a descend order
sort(x, is_ascend=0) = [[ 4., 1.],
[ 3., 1.]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/ordering_op.cc:L107</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array</li>
<li><strong>axis</strong> (<em>int or None, optional, default='-1'</em>) – Axis along which to choose sort the input tensor. If not given, the flattened array is used. Default is -1.</li>
<li><strong>is_ascend</strong> (<em>boolean, optional, default=True</em>) – Whether to sort in ascending or descending order.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.split">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">split</code><span class="sig-paren">(</span><em>data=None</em>, <em>num_outputs=_Null</em>, <em>axis=_Null</em>, <em>squeeze_axis=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.split" title="Permalink to this definition"></a></dt>
<dd><p>Splits an array along a particular axis into multiple sub-arrays.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><code class="docutils literal"><span class="pre">SliceChannel</span></code> is deprecated. Use <code class="docutils literal"><span class="pre">split</span></code> instead.</p>
</div>
<p><strong>Note</strong> that <cite>num_outputs</cite> should evenly divide the length of the axis
along which to split the array.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[[ 1.]
[ 2.]]
[[ 3.]
[ 4.]]
[[ 5.]
[ 6.]]]
x.shape = (3, 2, 1)
y = split(x, axis=1, num_outputs=2) // a list of 2 arrays with shape (3, 1, 1)
y = [[[ 1.]]
[[ 3.]]
[[ 5.]]]
[[[ 2.]]
[[ 4.]]
[[ 6.]]]
y[0].shape = (3, 1, 1)
z = split(x, axis=0, num_outputs=3) // a list of 3 arrays with shape (1, 2, 1)
z = [[[ 1.]
[ 2.]]]
[[[ 3.]
[ 4.]]]
[[[ 5.]
[ 6.]]]
z[0].shape = (1, 2, 1)
</pre></div>
</div>
<p><cite>squeeze_axis=1</cite> removes the axis with length 1 from the shapes of the output arrays.
<strong>Note</strong> that setting <cite>squeeze_axis</cite> to <code class="docutils literal"><span class="pre">1</span></code> removes axis with length 1 only
along the <cite>axis</cite> which it is split.
Also <cite>squeeze_axis</cite> can be set to true only if <code class="docutils literal"><span class="pre">input.shape[axis]</span> <span class="pre">==</span> <span class="pre">num_outputs</span></code>.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>z = split(x, axis=0, num_outputs=3, squeeze_axis=1) // a list of 3 arrays with shape (2, 1)
z = [[ 1.]
[ 2.]]
[[ 3.]
[ 4.]]
[[ 5.]
[ 6.]]
z[0].shape = (2 ,1 )
</pre></div>
</div>
<p>Defined in src/operator/slice_channel.cc:L88</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>num_outputs</strong> (<em>int, required</em>) – Number of splits. Note that this should evenly divide the length of the <cite>axis</cite>.</li>
<li><strong>axis</strong> (<em>int, optional, default='1'</em>) – Axis along which to split.</li>
<li><strong>squeeze_axis</strong> (<em>boolean, optional, default=False</em>) – If true, Removes the axis with length 1 from the shapes of the output arrays. <strong>Note</strong> that setting <cite>squeeze_axis</cite> to <code class="docutils literal"><span class="pre">true</span></code> removes axis with length 1 only along the <cite>axis</cite> which it is split. Also <cite>squeeze_axis</cite> can be set to <code class="docutils literal"><span class="pre">true</span></code> only if <code class="docutils literal"><span class="pre">input.shape[axis]</span> <span class="pre">==</span> <span class="pre">num_outputs</span></code>.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sqrt">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sqrt</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sqrt" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise square-root value of the input.</p>
<div class="math">
\[\textrm{sqrt}(x) = \sqrt{x}\]</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">sqrt</span><span class="p">([</span><span class="mi">4</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">16</span><span class="p">])</span> <span class="o">=</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="mi">4</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L347</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.square">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">square</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.square" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise squared value of the input.</p>
<div class="math">
\[square(x) = x^2\]</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">square</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="mi">4</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="mi">4</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">16</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L329</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.stop_gradient">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">stop_gradient</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.stop_gradient" title="Permalink to this definition"></a></dt>
<dd><p>Stops gradient computation.</p>
<p>Stops the accumulated gradient of the inputs from flowing through this operator
in the backward direction. In other words, this operator prevents the contribution
of its inputs to be taken into account for computing gradients.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>v1 = [1, 2]
v2 = [0, 1]
a = Variable('a')
b = Variable('b')
b_stop_grad = stop_gradient(3 * b)
loss = MakeLoss(b_stop_grad + a)
executor = loss.simple_bind(ctx=cpu(), a=(1,2), b=(1,2))
executor.forward(is_train=True, a=v1, b=v2)
executor.outputs
[ 1. 5.]
executor.backward()
executor.grad_arrays
[ 0. 0.]
[ 1. 1.]
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L99</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sum">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sum</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sum" title="Permalink to this definition"></a></dt>
<dd><p>Computes the sum of array elements over given axes.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>sum</cite> and <cite>sum_axis</cite> are equivalent.</p>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>data = [[[1,2],[2,3],[1,3]],
[[1,4],[4,3],[5,2]],
[[7,1],[7,2],[7,3]]]
sum(data, axis=1)
[[ 4. 8.]
[ 10. 9.]
[ 21. 6.]]
sum(data, axis=[1,2])
[ 12. 19. 27.]
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L51</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sum_axis">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">sum_axis</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>keepdims=_Null</em>, <em>exclude=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sum_axis" title="Permalink to this definition"></a></dt>
<dd><p>Computes the sum of array elements over given axes.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last"><cite>sum</cite> and <cite>sum_axis</cite> are equivalent.</p>
</div>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>data = [[[1,2],[2,3],[1,3]],
[[1,4],[4,3],[5,2]],
[[7,1],[7,2],[7,3]]]
sum(data, axis=1)
[[ 4. 8.]
[ 10. 9.]
[ 21. 6.]]
sum(data, axis=[1,2])
[ 12. 19. 27.]
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L51</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape(tuple), optional, default=()</em>) – <p>The axis or axes along which to perform the reduction.</p>
<p>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.</p>
<p>If <cite>axis</cite> is int, a reduction is performed on a particular axis.</p>
<p>If <cite>axis</cite> is a tuple of ints, a reduction is performed on all the axes
specified in the tuple.</p>
<p>If <cite>exclude</cite> is true, reduction will be performed on the axes that are
NOT in axis instead.</p>
</li>
<li><strong>keepdims</strong> (<em>boolean, optional, default=False</em>) – If this is set to <cite>True</cite>, the reduced axes are left in the result as dimension with size one.</li>
<li><strong>exclude</strong> (<em>boolean, optional, default=False</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.swapaxes">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">swapaxes</code><span class="sig-paren">(</span><em>data=None</em>, <em>dim1=_Null</em>, <em>dim2=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.swapaxes" title="Permalink to this definition"></a></dt>
<dd><p>Interchanges two axes of an array.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span> x = [[1, 2, 3]])
swapaxes(x, 0, 1) = [[ 1],
[ 2],
[ 3]]
x = [[[ 0, 1],
[ 2, 3]],
[[ 4, 5],
[ 6, 7]]] // (2,2,2) array
swapaxes(x, 0, 2) = [[[ 0, 4],
[ 2, 6]],
[[ 1, 5],
[ 3, 7]]]
</pre></div>
</div>
<p>Defined in src/operator/swapaxis.cc:L55</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>dim1</strong> (<em>int (non-negative), optional, default=0</em>) – the first axis to be swapped.</li>
<li><strong>dim2</strong> (<em>int (non-negative), optional, default=0</em>) – the second axis to be swapped.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.take">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">take</code><span class="sig-paren">(</span><em>a=None</em>, <em>indices=None</em>, <em>axis=_Null</em>, <em>mode=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.take" title="Permalink to this definition"></a></dt>
<dd><p>Takes elements from an input array along the given axis.</p>
<p>This function slices the input array along a particular axis with the provided indices.</p>
<p>Given an input array with shape <code class="docutils literal"><span class="pre">(d0,</span> <span class="pre">d1,</span> <span class="pre">d2)</span></code> and indices with shape <code class="docutils literal"><span class="pre">(i0,</span> <span class="pre">i1)</span></code>, the output
will have shape <code class="docutils literal"><span class="pre">(i0,</span> <span class="pre">i1,</span> <span class="pre">d1,</span> <span class="pre">d2)</span></code>, computed by:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">output</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">,:,:]</span> <span class="o">=</span> <span class="nb">input</span><span class="p">[</span><span class="n">indices</span><span class="p">[</span><span class="n">i</span><span class="p">,</span><span class="n">j</span><span class="p">],:,:]</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<ul class="last simple">
<li><cite>axis</cite>- Only slicing along axis 0 is supported for now.</li>
<li><cite>mode</cite>- Only <cite>clip</cite> mode is supported for now.</li>
</ul>
</div>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 1., 2.],
[ 3., 4.],
[ 5., 6.]]
// takes elements with specified indices along axis 0
take(x, [[0,1],[1,2]]) = [[[ 1., 2.],
[ 3., 4.]],
[[ 3., 4.],
[ 5., 6.]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/indexing_op.cc:L117</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="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>indices</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The indices of the values to be extracted.</li>
<li><strong>axis</strong> (<em>int, optional, default='0'</em>) – The axis of input array to be taken.</li>
<li><strong>mode</strong> (<em>{'clip', 'raise', 'wrap'},optional, default='clip'</em>) – Specify how out-of-bound indices bahave. “clip” means clip to the range. So, if all indices mentioned are too large, they are replaced by the index that addresses the last element along an axis. “wrap” means to wrap around. “raise” means to raise an error.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.tan">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">tan</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.tan" title="Permalink to this definition"></a></dt>
<dd><p>Computes the element-wise tangent of the input array.</p>
<p>The input should be in radians (<span class="math">\(2\pi\)</span> rad equals 360 degrees).</p>
<div class="math">
\[tan([0, \pi/4, \pi/2]) = [0, 1, -inf]\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L489</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.tanh">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">tanh</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.tanh" title="Permalink to this definition"></a></dt>
<dd><p>Returns the hyperbolic tangent of the input array, computed element-wise.</p>
<div class="math">
\[tanh(x) = sinh(x) / cosh(x)\]</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L609</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.tile">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">tile</code><span class="sig-paren">(</span><em>data=None</em>, <em>reps=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.tile" title="Permalink to this definition"></a></dt>
<dd><p>Repeats the whole array multiple times.</p>
<p>If <code class="docutils literal"><span class="pre">reps</span></code> has length <em>d</em>, and input array has dimension of <em>n</em>. There are
there cases:</p>
<ul>
<li><p class="first"><strong>n=d</strong>. Repeat <em>i</em>-th dimension of the input by <code class="docutils literal"><span class="pre">reps[i]</span></code> times:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span>
<span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]]</span>
<span class="n">tile</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">reps</span><span class="o">=</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="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
</pre></div>
</div>
</li>
<li><p class="first"><strong>n>d</strong>. <code class="docutils literal"><span class="pre">reps</span></code> is promoted to length <em>n</em> by pre-pending 1’s to it. Thus for
an input shape <code class="docutils literal"><span class="pre">(2,3)</span></code>, <code class="docutils literal"><span class="pre">repos=(2,)</span></code> is treated as <code class="docutils literal"><span class="pre">(1,2)</span></code>:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">tile</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">reps</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
</pre></div>
</div>
</li>
<li><p class="first"><strong>n<d</strong>. The input is promoted to be d-dimensional by prepending new axes. So a
shape <code class="docutils literal"><span class="pre">(2,2)</span></code> array is promoted to <code class="docutils literal"><span class="pre">(1,2,2)</span></code> for 3-D replication:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">tile</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">reps</span><span class="o">=</span><span class="p">(</span><span class="mi">2</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="o">=</span> <span class="p">[[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]],</span>
<span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]]</span>
</pre></div>
</div>
</li>
</ul>
<p>Defined in src/operator/tensor/matrix_op.cc:L559</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data array</li>
<li><strong>reps</strong> (<em>Shape(tuple), required</em>) – The number of times for repeating the tensor a. If reps has length d, the result will have dimension of max(d, a.ndim); If a.ndim < d, a is promoted to be d-dimensional by prepending new axes. If a.ndim > d, reps is promoted to a.ndim by pre-pending 1’s to it.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.topk">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">topk</code><span class="sig-paren">(</span><em>data=None</em>, <em>axis=_Null</em>, <em>k=_Null</em>, <em>ret_typ=_Null</em>, <em>is_ascend=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.topk" title="Permalink to this definition"></a></dt>
<dd><p>Returns the top <em>k</em> elements in an input array along the given axis.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span>x = [[ 0.3, 0.2, 0.4],
[ 0.1, 0.3, 0.2]]
// returns an index of the largest element on last axis
topk(x) = [[ 2.],
[ 1.]]
// returns the value of top-2 largest elements on last axis
topk(x, ret_typ='value', k=2) = [[ 0.4, 0.3],
[ 0.3, 0.2]]
// returns the value of top-2 smallest elements on last axis
topk(x, ret_typ='value', k=2, is_ascend=1) = [[ 0.2 , 0.3],
[ 0.1 , 0.2]]
// returns the value of top-2 largest elements on axis 0
topk(x, axis=0, ret_typ='value', k=2) = [[ 0.3, 0.3, 0.4],
[ 0.1, 0.2, 0.2]]
// flattens and then returns list of both values and indices
topk(x, ret_typ='both', k=2) = [[[ 0.4, 0.3], [ 0.3, 0.2]] , [[ 2., 0.], [ 1., 2.]]]
</pre></div>
</div>
<p>Defined in src/operator/tensor/ordering_op.cc:L44</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array</li>
<li><strong>axis</strong> (<em>int or None, optional, default='-1'</em>) – Axis along which to choose the top k indices. If not given, the flattened array is used. Default is -1.</li>
<li><strong>k</strong> (<em>int, optional, default='1'</em>) – Number of top elements to select, should be always smaller than or equal to the element number in the given axis. A global sort is performed if set k < 1.</li>
<li><strong>ret_typ</strong> (<em>{'both', 'indices', 'mask', 'value'},optional, default='indices'</em>) – The return type.
“value” means to return the top k values, “indices” means to return the indices of the top k values, “mask” means to return a mask array containing 0 and 1. 1 means the top k values. “both” means to return a list of both values and indices of top k elements.</li>
<li><strong>is_ascend</strong> (<em>boolean, optional, default=False</em>) – Whether to choose k largest or k smallest elements. Top K largest elements will be chosen if set to false.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.transpose">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">transpose</code><span class="sig-paren">(</span><em>data=None</em>, <em>axes=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.transpose" title="Permalink to this definition"></a></dt>
<dd><p>Permutes the dimensions of an array.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span>
<span class="p">[</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]]</span>
<span class="n">transpose</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]]</span>
<span class="n">x</span> <span class="o">=</span> <span class="p">[[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">]],</span>
<span class="p">[[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]]]</span>
<span class="n">transpose</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">5.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">]],</span>
<span class="p">[[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">4.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]]]</span>
<span class="n">transpose</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">axes</span><span class="o">=</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">5.</span><span class="p">,</span> <span class="mf">6.</span><span class="p">]],</span>
<span class="p">[[</span> <span class="mf">3.</span><span class="p">,</span> <span class="mf">4.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_op.cc:L176</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Source input</li>
<li><strong>axes</strong> (<em>Shape(tuple), optional, default=()</em>) – Target axis order. By default the axes will be inverted.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.trunc">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">trunc</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.trunc" title="Permalink to this definition"></a></dt>
<dd><p>Return the element-wise truncated value of the input.</p>
<p>The truncated value of the scalar x is the nearest integer i which is closer to
zero than x is. In short, the fractional part of the signed number x is discarded.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">trunc</span><span class="p">([</span><span class="o">-</span><span class="mf">2.1</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.9</span><span class="p">,</span> <span class="mf">1.5</span><span class="p">,</span> <span class="mf">1.9</span><span class="p">,</span> <span class="mf">2.1</span><span class="p">])</span> <span class="o">=</span> <span class="p">[</span><span class="o">-</span><span class="mf">2.</span><span class="p">,</span> <span class="o">-</span><span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op.cc:L304</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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.uniform">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">uniform</code><span class="sig-paren">(</span><em>low=_Null</em>, <em>high=_Null</em>, <em>shape=_Null</em>, <em>ctx=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.uniform" title="Permalink to this definition"></a></dt>
<dd><p>Draw random samples from a uniform distribution.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">The existing alias <code class="docutils literal"><span class="pre">uniform</span></code> is deprecated.</p>
</div>
<p>Samples are uniformly distributed over the half-open interval <em>[low, high)</em>
(includes <em>low</em>, but excludes <em>high</em>).</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">random_uniform</span><span class="p">(</span><span class="n">low</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">high</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.60276335</span><span class="p">,</span> <span class="mf">0.85794562</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.54488319</span><span class="p">,</span> <span class="mf">0.84725171</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/random/sample_op.cc:L45</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, optional, default=0</em>) – Lower bound of the distribution.</li>
<li><strong>high</strong> (<em>float, optional, default=1</em>) – Upper bound of the distribution.</li>
<li><strong>shape</strong> (<em>Shape(tuple), optional, default=()</em>) – Shape of the output.</li>
<li><strong>ctx</strong> (<em>string, optional, default=''</em>) – Context of output, in format [cpu|gpu|cpu_pinned](n). Only used for imperative calls.</li>
<li><strong>dtype</strong> (<em>{'None', 'float16', 'float32', 'float64'},optional, default='None'</em>) – DType of the output in case this can’t be inferred. Defaults to float32 if not defined (dtype=None).</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.where">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">where</code><span class="sig-paren">(</span><em>condition=None</em>, <em>x=None</em>, <em>y=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.where" title="Permalink to this definition"></a></dt>
<dd><p>Given three ndarrays, condition, x, and y, return an ndarray with the elements from x or y, depending on the elements from condition are true or false. x and y must have the same shape. If condition has the same shape as x, each element in the output array is from x if the corresponding element in the condition is true, and from y if false. If condition does not have the same shape as x, it must be a 1D array whose size is the same as x’s first dimension size. Each row of the output array is from x’s row if the corresponding element from condition is true, and from y’s row if false.</p>
<p>From:src/operator/tensor/control_flow_op.cc:21</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>condition</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – condition array</li>
<li><strong>x</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – </li>
<li><strong>y</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – </li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.zeros_like">
<code class="descclassname">mxnet.ndarray.</code><code class="descname">zeros_like</code><span class="sig-paren">(</span><em>data=None</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.zeros_like" title="Permalink to this definition"></a></dt>
<dd><p>Return an array of zeros with the same shape and type
as the input array.</p>
<p>Examples:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">,</span> <span class="mf">1.</span><span class="p">]]</span>
<span class="n">zeros_like</span><span class="p">(</span><span class="n">x</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">]]</span>
</pre></div>
</div>
<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>data</strong> (<a class="reference internal" href="#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong>
The output of this function.</p>
</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<span class="target" id="module-mxnet.random"></span><p>Random number interface of MXNet.</p>
<dl class="function">
<dt id="mxnet.random.seed">
<code class="descclassname">mxnet.random.</code><code class="descname">seed</code><span class="sig-paren">(</span><em>seed_state</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.random.seed" title="Permalink to this definition"></a></dt>
<dd><p>Seeds the random number generators in MXNet.</p>
<p>This affects the behavior of modules in MXNet that uses random number generators,
like the dropout operator and <cite>NDArray</cite>‘s random sampling operators.</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>seed_state</strong> (<em>int</em>) – The random number seed to set to all devices.</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>Random number generators in MXNet are device specific. Therefore, random numbers
generated from two devices can be different even if they are seeded using the same seed.</p>
<p class="rubric">Example</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random_normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span>
<span class="go">[[ 1.36481571 -0.62203991]</span>
<span class="go"> [-1.4962182 -0.08511394]]</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random_normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span>
<span class="go">[[ 1.09544981 -0.20014545]</span>
<span class="go"> [-0.20808885 0.2527658 ]]</span>
<span class="go">>>></span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random_normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span>
<span class="go">[[ 0.47400656 -0.75213492]</span>
<span class="go"> [ 0.20251541 0.95352972]]</span>
<span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random_normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span>
<span class="go">[[ 0.47400656 -0.75213492]</span>
<span class="go"> [ 0.20251541 0.95352972]]</span>
</pre></div>
</div>
</dd></dl>
<script>auto_index("api-reference");</script></div>
</div>
<div class="container">
<div class="footer">
<p> © 2015-2017 DMLC. All rights reserved. </p>
</div>
</div>
</div>
<div aria-label="main navigation" class="sphinxsidebar rightsidebar" role="navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">NDArray API</a><ul>
<li><a class="reference internal" href="#overview">Overview</a></li>
<li><a class="reference internal" href="#the-ndarray-class">The <code class="docutils literal"><span class="pre">NDArray</span></code> class</a><ul>
<li><a class="reference internal" href="#array-attributes">Array attributes</a></li>
<li><a class="reference internal" href="#array-conversion">Array conversion</a></li>
<li><a class="reference internal" href="#array-change-shape">Array change shape</a></li>
<li><a class="reference internal" href="#arithmetic-operations">Arithmetic operations</a></li>
<li><a class="reference internal" href="#in-place-arithmetic-operations">In-place arithmetic operations</a></li>
<li><a class="reference internal" href="#comparison-operators">Comparison operators</a></li>
<li><a class="reference internal" href="#indexing">Indexing</a></li>
<li><a class="reference internal" href="#lazy-evaluation">Lazy evaluation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#array-creation-routines">Array creation routines</a></li>
<li><a class="reference internal" href="#array-manipulation-routines">Array manipulation routines</a><ul>
<li><a class="reference internal" href="#changing-array-shape-and-type">Changing array shape and type</a></li>
<li><a class="reference internal" href="#expanding-array-elements">Expanding array elements</a></li>
<li><a class="reference internal" href="#rearranging-elements">Rearranging elements</a></li>
<li><a class="reference internal" href="#joining-and-splitting-arrays">Joining and splitting arrays</a></li>
<li><a class="reference internal" href="#indexing-routines">Indexing routines</a></li>
</ul>
</li>
<li><a class="reference internal" href="#mathematical-functions">Mathematical functions</a><ul>
<li><a class="reference internal" href="#arithmetic-operations">Arithmetic operations</a></li>
<li><a class="reference internal" href="#trigonometric-functions">Trigonometric functions</a></li>
<li><a class="reference internal" href="#hyperbolic-functions">Hyperbolic functions</a></li>
<li><a class="reference internal" href="#reduce-functions">Reduce functions</a></li>
<li><a class="reference internal" href="#rounding">Rounding</a></li>
<li><a class="reference internal" href="#exponents-and-logarithms">Exponents and logarithms</a></li>
<li><a class="reference internal" href="#powers">Powers</a></li>
<li><a class="reference internal" href="#logic-functions">Logic functions</a></li>
<li><a class="reference internal" href="#random-sampling">Random sampling</a></li>
<li><a class="reference internal" href="#sorting-and-searching">Sorting and searching</a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
</ul>
</li>
<li><a class="reference internal" href="#neural-network">Neural network</a><ul>
<li><a class="reference internal" href="#basic">Basic</a></li>
<li><a class="reference internal" href="#more">More</a></li>
</ul>
</li>
<li><a class="reference internal" href="#api-reference">API Reference</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div> <!-- pagename != index -->
<script crossorigin="anonymous" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="../../_static/js/sidebar.js" type="text/javascript"></script>
<script src="../../_static/js/search.js" type="text/javascript"></script>
<script src="../../_static/js/navbar.js" type="text/javascript"></script>
<script src="../../_static/js/clipboard.min.js" type="text/javascript"></script>
<script src="../../_static/js/copycode.js" type="text/javascript"></script>
<script type="text/javascript">
$('body').ready(function () {
$('body').css('visibility', 'visible');
});
</script>
</div></body>
</html>