blob: 66fbf6245f0caeb388c468eb7d5901c3c4e54397 [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"/>
<meta content="Sparse NDArray API" property="og:title">
<meta content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" property="og:image">
<meta content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" property="og:image:secure_url">
<meta content="Sparse NDArray API" property="og:description"/>
<title>Sparse 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: '.txt'
};
</script>
<script src="https://code.jquery.com/jquery-1.11.1.min.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://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script>
<script type="text/javascript"> jQuery(function() { Search.loadIndex("/versions/1.4.1/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://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> -->
<!-- -->
<link href="../../../genindex.html" rel="index" title="Index">
<link href="../../../search.html" rel="search" title="Search"/>
<link href="../index.html" rel="up" title="MXNet - Python API"/>
<link href="contrib.html" rel="next" title="Contrib NDArray API"/>
<link href="linalg.html" rel="prev" title="Linear Algebra NDArray API"/>
<link href="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-icon.png" rel="icon" type="image/png"/>
</link></link></link></meta></meta></meta></head>
<body background="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-background-compressed.jpeg" role="document">
<div class="content-block"><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="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet_logo.png"/></a>
</h1>
<nav class="nav-bar" id="main-nav">
<a class="main-nav-link" href="/versions/1.4.1/install/index.html">Install</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">Gluon <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/gluon/gluon.html">About</a></li>
<li><a class="main-nav-link" href="https://www.d2l.ai/">Dive into Deep Learning</a></li>
<li><a class="main-nav-link" href="https://gluon-cv.mxnet.io">GluonCV Toolkit</a></li>
<li><a class="main-nav-link" href="https://gluon-nlp.mxnet.io/">GluonNLP Toolkit</a></li>
</ul>
</span>
<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 navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/api/python/index.html">Python</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/c++/index.html">C++</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/clojure/index.html">Clojure</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/java/index.html">Java</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/julia/index.html">Julia</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/perl/index.html">Perl</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/r/index.html">R</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/scala/index.html">Scala</a></li>
</ul>
</span>
<span id="dropdown-menu-position-anchor-docs">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Docs <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-docs">
<li><a class="main-nav-link" href="/versions/1.4.1/faq/index.html">FAQ</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/index.html">Tutorials</a>
<li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.4.1/example">Examples</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/architecture/index.html">Architecture</a></li>
<li><a class="main-nav-link" href="https://cwiki.apache.org/confluence/display/MXNET/Apache+MXNet+Home">Developer Wiki</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/model_zoo/index.html">Model Zoo</a></li>
<li><a class="main-nav-link" href="https://github.com/onnx/onnx-mxnet">ONNX</a></li>
</li></ul>
</span>
<span id="dropdown-menu-position-anchor-community">
<a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Community <span class="caret"></span></a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-community">
<li><a class="main-nav-link" href="http://discuss.mxnet.io">Forum</a></li>
<li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.4.1">Github</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/community/contribute.html">Contribute</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/community/ecosystem.html">Ecosystem</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/community/powered_by.html">Powered By</a></li>
</ul>
</span>
<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">1.4.1<span class="caret"></span></a><ul id="package-dropdown-menu" class="dropdown-menu"><li><a href="/">master</a></li><li><a href="/versions/1.7.0/">1.7.0</a></li><li><a href=/versions/1.6.0/>1.6.0</a></li><li><a href=/versions/1.5.0/>1.5.0</a></li><li><a href=/versions/1.4.1/>1.4.1</a></li><li><a href=/versions/1.3.1/>1.3.1</a></li><li><a href=/versions/1.2.1/>1.2.1</a></li><li><a href=/versions/1.1.0/>1.1.0</a></li><li><a href=/versions/1.0.0/>1.0.0</a></li><li><a href=/versions/0.12.1/>0.12.1</a></li><li><a href=/versions/0.11.0/>0.11.0</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" id="burgerMenu">
<li><a href="/versions/1.4.1/install/index.html">Install</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/index.html">Tutorials</a></li>
<li class="dropdown-submenu dropdown">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">Gluon</a>
<ul class="dropdown-menu navbar-menu" id="package-dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/tutorials/gluon/gluon.html">About</a></li>
<li><a class="main-nav-link" href="http://gluon.mxnet.io">The Straight Dope (Tutorials)</a></li>
<li><a class="main-nav-link" href="https://gluon-cv.mxnet.io">GluonCV Toolkit</a></li>
<li><a class="main-nav-link" href="https://gluon-nlp.mxnet.io/">GluonNLP Toolkit</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">API</a>
<ul class="dropdown-menu">
<li><a class="main-nav-link" href="/versions/1.4.1/api/python/index.html">Python</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/c++/index.html">C++</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/clojure/index.html">Clojure</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/java/index.html">Java</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/julia/index.html">Julia</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/perl/index.html">Perl</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/r/index.html">R</a></li>
<li><a class="main-nav-link" href="/versions/1.4.1/api/scala/index.html">Scala</a></li>
</ul>
</li>
<li class="dropdown-submenu">
<a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">Docs</a>
<ul class="dropdown-menu">
<li><a href="/versions/1.4.1/faq/index.html" tabindex="-1">FAQ</a></li>
<li><a href="/versions/1.4.1/tutorials/index.html" tabindex="-1">Tutorials</a></li>
<li><a href="https://github.com/apache/incubator-mxnet/tree/1.4.1/example" tabindex="-1">Examples</a></li>
<li><a href="/versions/1.4.1/architecture/index.html" tabindex="-1">Architecture</a></li>
<li><a href="https://cwiki.apache.org/confluence/display/MXNET/Apache+MXNet+Home" tabindex="-1">Developer Wiki</a></li>
<li><a href="/versions/1.4.1/model_zoo/index.html" tabindex="-1">Gluon Model Zoo</a></li>
<li><a href="https://github.com/onnx/onnx-mxnet" tabindex="-1">ONNX</a></li>
</ul>
</li>
<li class="dropdown-submenu dropdown">
<a aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" role="button" tabindex="-1">Community</a>
<ul class="dropdown-menu">
<li><a href="http://discuss.mxnet.io" tabindex="-1">Forum</a></li>
<li><a href="https://github.com/apache/incubator-mxnet/tree/1.4.1" tabindex="-1">Github</a></li>
<li><a href="/versions/1.4.1/community/contribute.html" tabindex="-1">Contribute</a></li>
<li><a href="/versions/1.4.1/community/ecosystem.html" tabindex="-1">Ecosystem</a></li>
<li><a href="/versions/1.4.1/community/powered_by.html" tabindex="-1">Powered By</a></li>
</ul>
</li>
<li id="dropdown-menu-position-anchor-version-mobile" class="dropdown-submenu" style="position: relative"><a href="#" tabindex="-1">1.4.1</a><ul class="dropdown-menu"><li><a tabindex="-1" href=/>master</a></li><li><a tabindex="-1" href=/versions/1.6.0/>1.6.0</a></li><li><a tabindex="-1" href=/versions/1.5.0/>1.5.0</a></li><li><a tabindex="-1" href=/versions/1.4.1/>1.4.1</a></li><li><a tabindex="-1" href=/versions/1.3.1/>1.3.1</a></li><li><a tabindex="-1" href=/versions/1.2.1/>1.2.1</a></li><li><a tabindex="-1" href=/versions/1.1.0/>1.1.0</a></li><li><a tabindex="-1" href=/versions/1.0.0/>1.0.0</a></li><li><a tabindex="-1" href=/versions/0.12.1/>0.12.1</a></li><li><a tabindex="-1" href=/versions/0.11.0/>0.11.0</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>
<script type="text/javascript">
$('body').css('background', 'white');
</script>
<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">MXNet APIs</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../c++/index.html">MXNet - C++ API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../clojure/index.html">MXNet - Clojure API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../julia/index.html">MXNet - Julia API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../perl/index.html">MXNet - Perl API</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../index.html">MXNet - Python API</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../index.html#autograd-api">Autograd API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#callback-api">Callback API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#contrib-package">Contrib Package</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#gluon-api">Gluon API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#image-api">Image API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#io-api">IO API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#kv-store-api">KV Store API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#metric-api">Metric API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#module-api">Module API</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../index.html#ndarray-api">NDArray API</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="ndarray.html">NDArray API</a></li>
<li class="toctree-l4"><a class="reference internal" href="random.html">Random Distribution Generator NDArray API</a></li>
<li class="toctree-l4"><a class="reference internal" href="linalg.html">Linear Algebra NDArray API</a></li>
<li class="toctree-l4 current"><a class="current reference internal" href="#">Sparse NDArray API</a></li>
<li class="toctree-l4"><a class="reference internal" href="contrib.html">Contrib NDArray API</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#optimization-api">Optimization API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#profiler-api">Profiler API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#run-time-compilation-api">Run-Time Compilation API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#symbol-api">Symbol API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#symbol-in-pictures-api">Symbol in Pictures API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../index.html#tools">Tools</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../r/index.html">MXNet - R API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../scala/index.html">MXNet - Scala API</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/index.html">MXNet Architecture</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../community/index.html">MXNet Community</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../faq/index.html">MXNet FAQ</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../gluon/index.html">About Gluon</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/index.html">Installing MXNet</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/index.html#nvidia-jetson-tx-family">Nvidia Jetson TX family</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/index.html#source-download">Source Download</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../model_zoo/index.html">MXNet Model Zoo</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="page-tracker"></div>
<!--- Licensed to the Apache Software Foundation (ASF) under one -->
<!--- or more contributor license agreements. See the NOTICE file -->
<!--- distributed with this work for additional information -->
<!--- regarding copyright ownership. The ASF licenses this file -->
<!--- to you under the Apache License, Version 2.0 (the -->
<!--- "License"); you may not use this file except in compliance -->
<!--- with the License. You may obtain a copy of the License at --><!--- http://www.apache.org/licenses/LICENSE-2.0 --><!--- Unless required by applicable law or agreed to in writing, -->
<!--- software distributed under the License is distributed on an -->
<!--- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -->
<!--- KIND, either express or implied. See the License for the -->
<!--- specific language governing permissions and limitations -->
<!--- under the License. --><div class="section" id="sparse-ndarray-api">
<span id="sparse-ndarray-api"></span><h1>Sparse NDArray API<a class="headerlink" href="#sparse-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 sparse 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.sparse" title="mxnet.ndarray.sparse"><code class="xref py py-obj docutils literal"><span class="pre">mxnet.ndarray.sparse</span></code></a></td>
<td>Sparse NDArray API of MXNet.</td>
</tr>
</tbody>
</table>
<p>The <code class="docutils literal"><span class="pre">CSRNDArray</span></code> and <code class="docutils literal"><span class="pre">RowSparseNDArray</span></code> API, defined in the <code class="docutils literal"><span class="pre">ndarray.sparse</span></code> package, provides
imperative sparse tensor operations.</p>
<p>An <code class="docutils literal"><span class="pre">CSRNDArray</span></code> inherits from <code class="docutils literal"><span class="pre">NDArray</span></code>, and represents a two-dimensional, fixed-size array in compressed sparse row format.</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">0</span><span class="p">],</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="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">csr</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">csr</span><span class="p">)</span>
<span class="go"><class 'mxnet.ndarray.sparse.CSRNDArray'></span>
<span class="gp">>>> </span><span class="n">csr</span><span class="o">.</span><span class="n">shape</span>
<span class="go">(3, 2)</span>
<span class="gp">>>> </span><span class="n">csr</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 1. 2. 3.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">csr</span><span class="o">.</span><span class="n">indices</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([0, 0, 1])</span>
<span class="gp">>>> </span><span class="n">csr</span><span class="o">.</span><span class="n">indptr</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([0, 1, 1, 3])</span>
<span class="gp">>>> </span><span class="n">csr</span><span class="o">.</span><span class="n">stype</span>
<span class="go">'csr'</span>
</pre></div>
</div>
<p>A detailed tutorial is available at
<a class="reference external" href="/versions/master/tutorials/sparse/csr.html">CSRNDArray - NDArray in Compressed Sparse Row Storage Format</a>.
<br/></p>
<p>An <code class="docutils literal"><span class="pre">RowSparseNDArray</span></code> inherits from <code class="docutils literal"><span class="pre">NDArray</span></code>, and represents a multi-dimensional, fixed-size array in row sparse format.</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">0</span><span class="p">],</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="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">row_sparse</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">row_sparse</span><span class="p">)</span>
<span class="go"><class 'mxnet.ndarray.sparse.RowSparseNDArray'></span>
<span class="gp">>>> </span><span class="n">row_sparse</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1. 0.],</span>
<span class="go"> [ 2. 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">row_sparse</span><span class="o">.</span><span class="n">indices</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([0, 2])</span>
<span class="gp">>>> </span><span class="n">row_sparse</span><span class="o">.</span><span class="n">stype</span>
<span class="go">'row_sparse'</span>
</pre></div>
</div>
<p>A detailed tutorial is available at
<a class="reference external" href="/versions/master/tutorials/sparse/row_sparse.html">RowSparseNDArray - NDArray for Sparse Gradient Updates</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.sparse</span></code> is similar to <code class="docutils literal"><span class="pre">mxnet.ndarray</span></code> in some aspects. But the differences are not negligible. For instance:</p>
<ul class="last simple">
<li>Only a subset of operators in <code class="docutils literal"><span class="pre">mxnet.ndarray</span></code> have efficient sparse implementations in <code class="docutils literal"><span class="pre">mxnet.ndarray.sparse</span></code>.</li>
<li>If an operator do not occur in the <code class="docutils literal"><span class="pre">mxnet.ndarray.sparse</span></code> namespace, that means the operator does not have an efficient sparse implementation yet. If sparse inputs are passed to such an operator, it will convert inputs to the dense format and fallback to the already available dense implementation.</li>
<li>The storage types (<code class="docutils literal"><span class="pre">stype</span></code>) of sparse operators’ outputs depend on the storage types of inputs.
By default the operators not available in <code class="docutils literal"><span class="pre">mxnet.ndarray.sparse</span></code> infer “default” (dense) storage type for outputs.
Please refer to the [API Reference](#api-reference) section for further details on specific operators.</li>
</ul>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p><code class="docutils literal"><span class="pre">mxnet.ndarray.sparse.CSRNDArray</span></code> is similar to <code class="docutils literal"><span class="pre">scipy.sparse.csr_matrix</span></code> in some aspects. But they differ in a few aspects:</p>
<ul class="last simple">
<li>In MXNet the column indices (<code class="docutils literal"><span class="pre">CSRNDArray.indices</span></code>) for a given row are expected to be <strong>sorted in ascending order</strong>.
Duplicate column entries for the same row are not allowed.</li>
<li><code class="docutils literal"><span class="pre">CSRNDArray.data</span></code>, <code class="docutils literal"><span class="pre">CSRNDArray.indices</span></code> and <code class="docutils literal"><span class="pre">CSRNDArray.indptr</span></code> always create deep copies, while it’s not the case in <code class="docutils literal"><span class="pre">scipy.sparse.csr_matrix</span></code>.</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.sparse.CSRNDArray</span></code> class and the <code class="docutils literal"><span class="pre">ndarray.sparse.RowSparseNDArray</span></code> class,
and then list other routines provided by the <code class="docutils literal"><span class="pre">ndarray.sparse</span></code> package.</p>
<p>The <code class="docutils literal"><span class="pre">ndarray.sparse</span></code> package provides several classes:</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="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray</span></code></a></td>
<td>A sparse representation of 2D NDArray in the Compressed Sparse Row format.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray</span></code></a></td>
<td>A sparse representation of a set of NDArray row slices at given indices.</td>
</tr>
</tbody>
</table>
<p>We summarize the interface for each class in the following sections.</p>
</div>
<div class="section" id="the-csrndarray-class">
<span id="the-csrndarray-class"></span><h2>The <code class="docutils literal"><span class="pre">CSRNDArray</span></code> class<a class="headerlink" href="#the-csrndarray-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.sparse.CSRNDArray.shape" title="mxnet.ndarray.sparse.CSRNDArray.shape"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.shape</span></code></a></td>
<td>Tuple of array dimensions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.context" title="mxnet.ndarray.sparse.CSRNDArray.context"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.context</span></code></a></td>
<td>Device context of the array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.dtype" title="mxnet.ndarray.sparse.CSRNDArray.dtype"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.dtype</span></code></a></td>
<td>Data-type of the array’s elements.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.stype" title="mxnet.ndarray.sparse.CSRNDArray.stype"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.stype</span></code></a></td>
<td>Storage-type of the array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.data" title="mxnet.ndarray.sparse.CSRNDArray.data"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.data</span></code></a></td>
<td>A deep copy NDArray of the data array of the CSRNDArray.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.indices" title="mxnet.ndarray.sparse.CSRNDArray.indices"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.indices</span></code></a></td>
<td>A deep copy NDArray of the indices array of the CSRNDArray.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.indptr" title="mxnet.ndarray.sparse.CSRNDArray.indptr"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.indptr</span></code></a></td>
<td>A deep copy NDArray of the indptr array of the CSRNDArray.</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.sparse.CSRNDArray.copy" title="mxnet.ndarray.sparse.CSRNDArray.copy"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.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.sparse.CSRNDArray.copyto" title="mxnet.ndarray.sparse.CSRNDArray.copyto"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.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.sparse.CSRNDArray.as_in_context" title="mxnet.ndarray.sparse.CSRNDArray.as_in_context"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.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.sparse.CSRNDArray.asscipy" title="mxnet.ndarray.sparse.CSRNDArray.asscipy"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.asscipy</span></code></a></td>
<td>Returns a <code class="docutils literal"><span class="pre">scipy.sparse.csr.csr_matrix</span></code> object with value copied from this array</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.asnumpy" title="mxnet.ndarray.sparse.CSRNDArray.asnumpy"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.asnumpy</span></code></a></td>
<td>Return a dense <code class="docutils literal"><span class="pre">numpy.ndarray</span></code> object with value copied from this array</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.asscalar" title="mxnet.ndarray.sparse.CSRNDArray.asscalar"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.asscalar</span></code></a></td>
<td>Returns a scalar whose value is copied from this array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.astype" title="mxnet.ndarray.sparse.CSRNDArray.astype"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.astype</span></code></a></td>
<td>Return a copy of the array after casting to a specified type.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.tostype" title="mxnet.ndarray.sparse.CSRNDArray.tostype"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.tostype</span></code></a></td>
<td>Return a copy of the array with chosen storage type.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-inspection">
<span id="array-inspection"></span><h3>Array inspection<a class="headerlink" href="#array-inspection" 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.sparse.CSRNDArray.check_format" title="mxnet.ndarray.sparse.CSRNDArray.check_format"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.check_format</span></code></a></td>
<td>Check whether the NDArray format is valid.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-creation">
<span id="array-creation"></span><h3>Array creation<a class="headerlink" href="#array-creation" 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.sparse.CSRNDArray.zeros_like" title="mxnet.ndarray.sparse.CSRNDArray.zeros_like"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.zeros_like</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.zeros_like" title="mxnet.ndarray.sparse.zeros_like"><code class="xref py py-func docutils literal"><span class="pre">zeros_like()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-reduction">
<span id="array-reduction"></span><h3>Array reduction<a class="headerlink" href="#array-reduction" 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.sparse.CSRNDArray.sum" title="mxnet.ndarray.sparse.CSRNDArray.sum"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.sum</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sum" title="mxnet.ndarray.sparse.sum"><code class="xref py py-func docutils literal"><span class="pre">sum()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.mean" title="mxnet.ndarray.sparse.CSRNDArray.mean"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.mean</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.mean" title="mxnet.ndarray.sparse.mean"><code class="xref py py-func docutils literal"><span class="pre">mean()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.norm" title="mxnet.ndarray.sparse.CSRNDArray.norm"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.norm</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.norm" title="mxnet.ndarray.sparse.norm"><code class="xref py py-func docutils literal"><span class="pre">norm()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-rounding">
<span id="array-rounding"></span><h3>Array rounding<a class="headerlink" href="#array-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.sparse.CSRNDArray.round" title="mxnet.ndarray.sparse.CSRNDArray.round"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.round</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.round" title="mxnet.ndarray.sparse.round"><code class="xref py py-func docutils literal"><span class="pre">round()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.rint" title="mxnet.ndarray.sparse.CSRNDArray.rint"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.rint</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.rint" title="mxnet.ndarray.sparse.rint"><code class="xref py py-func docutils literal"><span class="pre">rint()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.fix" title="mxnet.ndarray.sparse.CSRNDArray.fix"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.fix</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.fix" title="mxnet.ndarray.sparse.fix"><code class="xref py py-func docutils literal"><span class="pre">fix()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.floor" title="mxnet.ndarray.sparse.CSRNDArray.floor"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.floor</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.floor" title="mxnet.ndarray.sparse.floor"><code class="xref py py-func docutils literal"><span class="pre">floor()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.ceil" title="mxnet.ndarray.sparse.CSRNDArray.ceil"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.ceil</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.ceil" title="mxnet.ndarray.sparse.ceil"><code class="xref py py-func docutils literal"><span class="pre">ceil()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.trunc" title="mxnet.ndarray.sparse.CSRNDArray.trunc"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.trunc</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.trunc" title="mxnet.ndarray.sparse.trunc"><code class="xref py py-func docutils literal"><span class="pre">trunc()</span></code></a>.</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.sparse.CSRNDArray.sin" title="mxnet.ndarray.sparse.CSRNDArray.sin"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.sin</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sin" title="mxnet.ndarray.sparse.sin"><code class="xref py py-func docutils literal"><span class="pre">sin()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.tan" title="mxnet.ndarray.sparse.CSRNDArray.tan"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.tan</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tan" title="mxnet.ndarray.sparse.tan"><code class="xref py py-func docutils literal"><span class="pre">tan()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.arcsin" title="mxnet.ndarray.sparse.CSRNDArray.arcsin"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.arcsin</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsin" title="mxnet.ndarray.sparse.arcsin"><code class="xref py py-func docutils literal"><span class="pre">arcsin()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.arctan" title="mxnet.ndarray.sparse.CSRNDArray.arctan"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.arctan</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctan" title="mxnet.ndarray.sparse.arctan"><code class="xref py py-func docutils literal"><span class="pre">arctan()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.degrees" title="mxnet.ndarray.sparse.CSRNDArray.degrees"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.degrees</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.degrees" title="mxnet.ndarray.sparse.degrees"><code class="xref py py-func docutils literal"><span class="pre">degrees()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.radians" title="mxnet.ndarray.sparse.CSRNDArray.radians"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.radians</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.radians" title="mxnet.ndarray.sparse.radians"><code class="xref py py-func docutils literal"><span class="pre">radians()</span></code></a>.</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.sparse.CSRNDArray.sinh" title="mxnet.ndarray.sparse.CSRNDArray.sinh"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.sinh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sinh" title="mxnet.ndarray.sparse.sinh"><code class="xref py py-func docutils literal"><span class="pre">sinh()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.tanh" title="mxnet.ndarray.sparse.CSRNDArray.tanh"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.tanh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tanh" title="mxnet.ndarray.sparse.tanh"><code class="xref py py-func docutils literal"><span class="pre">tanh()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.arcsinh" title="mxnet.ndarray.sparse.CSRNDArray.arcsinh"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.arcsinh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsinh" title="mxnet.ndarray.sparse.arcsinh"><code class="xref py py-func docutils literal"><span class="pre">arcsinh()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.arctanh" title="mxnet.ndarray.sparse.CSRNDArray.arctanh"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.arctanh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctanh" title="mxnet.ndarray.sparse.arctanh"><code class="xref py py-func docutils literal"><span class="pre">arctanh()</span></code></a>.</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.sparse.CSRNDArray.expm1" title="mxnet.ndarray.sparse.CSRNDArray.expm1"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.expm1</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.expm1" title="mxnet.ndarray.sparse.expm1"><code class="xref py py-func docutils literal"><span class="pre">expm1()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.log1p" title="mxnet.ndarray.sparse.CSRNDArray.log1p"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.log1p</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.log1p" title="mxnet.ndarray.sparse.log1p"><code class="xref py py-func docutils literal"><span class="pre">log1p()</span></code></a>.</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.sparse.CSRNDArray.sqrt" title="mxnet.ndarray.sparse.CSRNDArray.sqrt"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.sqrt</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sqrt" title="mxnet.ndarray.sparse.sqrt"><code class="xref py py-func docutils literal"><span class="pre">sqrt()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.square" title="mxnet.ndarray.sparse.CSRNDArray.square"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.square</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="joining-arrays">
<span id="joining-arrays"></span><h3>Joining arrays<a class="headerlink" href="#joining-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.sparse.concat" title="mxnet.ndarray.sparse.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>
</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.sparse.CSRNDArray.__getitem__" title="mxnet.ndarray.sparse.CSRNDArray.__getitem__"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.__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.sparse.CSRNDArray.__setitem__" title="mxnet.ndarray.sparse.CSRNDArray.__setitem__"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.__setitem__</span></code></a></td>
<td>x.__setitem__(i, y) <=> x[i]=y</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.slice" title="mxnet.ndarray.sparse.CSRNDArray.slice"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.slice</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.slice" title="mxnet.ndarray.sparse.slice"><code class="xref py py-func docutils literal"><span class="pre">slice()</span></code></a>.</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.sparse.CSRNDArray.abs" title="mxnet.ndarray.sparse.CSRNDArray.abs"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.abs</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.abs" title="mxnet.ndarray.sparse.abs"><code class="xref py py-func docutils literal"><span class="pre">abs()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.clip" title="mxnet.ndarray.sparse.CSRNDArray.clip"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.clip</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.clip" title="mxnet.ndarray.sparse.clip"><code class="xref py py-func docutils literal"><span class="pre">clip()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray.sign" title="mxnet.ndarray.sparse.CSRNDArray.sign"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.sign</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sign" title="mxnet.ndarray.sparse.sign"><code class="xref py py-func docutils literal"><span class="pre">sign()</span></code></a>.</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.sparse.CSRNDArray.wait_to_read" title="mxnet.ndarray.sparse.CSRNDArray.wait_to_read"><code class="xref py py-obj docutils literal"><span class="pre">CSRNDArray.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="the-rowsparsendarray-class">
<span id="the-rowsparsendarray-class"></span><h2>The <code class="docutils literal"><span class="pre">RowSparseNDArray</span></code> class<a class="headerlink" href="#the-rowsparsendarray-class" title="Permalink to this headline"></a></h2>
<div class="section" id="array-attributes">
<span id="id1"></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.sparse.RowSparseNDArray.shape" title="mxnet.ndarray.sparse.RowSparseNDArray.shape"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.shape</span></code></a></td>
<td>Tuple of array dimensions.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.context" title="mxnet.ndarray.sparse.RowSparseNDArray.context"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.context</span></code></a></td>
<td>Device context of the array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.dtype" title="mxnet.ndarray.sparse.RowSparseNDArray.dtype"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.dtype</span></code></a></td>
<td>Data-type of the array’s elements.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.stype" title="mxnet.ndarray.sparse.RowSparseNDArray.stype"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.stype</span></code></a></td>
<td>Storage-type of the array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.data" title="mxnet.ndarray.sparse.RowSparseNDArray.data"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.data</span></code></a></td>
<td>A deep copy NDArray of the data array of the RowSparseNDArray.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.indices" title="mxnet.ndarray.sparse.RowSparseNDArray.indices"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.indices</span></code></a></td>
<td>A deep copy NDArray of the indices array of the RowSparseNDArray.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-conversion">
<span id="id2"></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.sparse.RowSparseNDArray.copy" title="mxnet.ndarray.sparse.RowSparseNDArray.copy"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.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.sparse.RowSparseNDArray.copyto" title="mxnet.ndarray.sparse.RowSparseNDArray.copyto"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.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.sparse.RowSparseNDArray.as_in_context" title="mxnet.ndarray.sparse.RowSparseNDArray.as_in_context"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.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.sparse.RowSparseNDArray.asnumpy" title="mxnet.ndarray.sparse.RowSparseNDArray.asnumpy"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.asnumpy</span></code></a></td>
<td>Return a dense <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.sparse.RowSparseNDArray.asscalar" title="mxnet.ndarray.sparse.RowSparseNDArray.asscalar"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.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.sparse.RowSparseNDArray.astype" title="mxnet.ndarray.sparse.RowSparseNDArray.astype"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.astype</span></code></a></td>
<td>Return a copy of the array after casting to a specified type.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.tostype" title="mxnet.ndarray.sparse.RowSparseNDArray.tostype"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.tostype</span></code></a></td>
<td>Return a copy of the array with chosen storage type.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-inspection">
<span id="id3"></span><h3>Array inspection<a class="headerlink" href="#array-inspection" 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.sparse.RowSparseNDArray.check_format" title="mxnet.ndarray.sparse.RowSparseNDArray.check_format"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.check_format</span></code></a></td>
<td>Check whether the NDArray format is valid.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-creation">
<span id="id4"></span><h3>Array creation<a class="headerlink" href="#array-creation" 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.sparse.RowSparseNDArray.zeros_like" title="mxnet.ndarray.sparse.RowSparseNDArray.zeros_like"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.zeros_like</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.zeros_like" title="mxnet.ndarray.sparse.zeros_like"><code class="xref py py-func docutils literal"><span class="pre">zeros_like()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-reduction">
<span id="id5"></span><h3>Array reduction<a class="headerlink" href="#array-reduction" 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.sparse.RowSparseNDArray.norm" title="mxnet.ndarray.sparse.RowSparseNDArray.norm"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.norm</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.norm" title="mxnet.ndarray.sparse.norm"><code class="xref py py-func docutils literal"><span class="pre">norm()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="array-rounding">
<span id="id6"></span><h3>Array rounding<a class="headerlink" href="#array-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.sparse.RowSparseNDArray.round" title="mxnet.ndarray.sparse.RowSparseNDArray.round"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.round</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.round" title="mxnet.ndarray.sparse.round"><code class="xref py py-func docutils literal"><span class="pre">round()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.rint" title="mxnet.ndarray.sparse.RowSparseNDArray.rint"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.rint</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.rint" title="mxnet.ndarray.sparse.rint"><code class="xref py py-func docutils literal"><span class="pre">rint()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.fix" title="mxnet.ndarray.sparse.RowSparseNDArray.fix"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.fix</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.fix" title="mxnet.ndarray.sparse.fix"><code class="xref py py-func docutils literal"><span class="pre">fix()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.floor" title="mxnet.ndarray.sparse.RowSparseNDArray.floor"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.floor</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.floor" title="mxnet.ndarray.sparse.floor"><code class="xref py py-func docutils literal"><span class="pre">floor()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.ceil" title="mxnet.ndarray.sparse.RowSparseNDArray.ceil"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.ceil</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.ceil" title="mxnet.ndarray.sparse.ceil"><code class="xref py py-func docutils literal"><span class="pre">ceil()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.trunc" title="mxnet.ndarray.sparse.RowSparseNDArray.trunc"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.trunc</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.trunc" title="mxnet.ndarray.sparse.trunc"><code class="xref py py-func docutils literal"><span class="pre">trunc()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="trigonometric-functions">
<span id="id7"></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.sparse.RowSparseNDArray.sin" title="mxnet.ndarray.sparse.RowSparseNDArray.sin"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.sin</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sin" title="mxnet.ndarray.sparse.sin"><code class="xref py py-func docutils literal"><span class="pre">sin()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.tan" title="mxnet.ndarray.sparse.RowSparseNDArray.tan"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.tan</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tan" title="mxnet.ndarray.sparse.tan"><code class="xref py py-func docutils literal"><span class="pre">tan()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.arcsin" title="mxnet.ndarray.sparse.RowSparseNDArray.arcsin"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.arcsin</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsin" title="mxnet.ndarray.sparse.arcsin"><code class="xref py py-func docutils literal"><span class="pre">arcsin()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.arctan" title="mxnet.ndarray.sparse.RowSparseNDArray.arctan"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.arctan</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctan" title="mxnet.ndarray.sparse.arctan"><code class="xref py py-func docutils literal"><span class="pre">arctan()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.degrees" title="mxnet.ndarray.sparse.RowSparseNDArray.degrees"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.degrees</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.degrees" title="mxnet.ndarray.sparse.degrees"><code class="xref py py-func docutils literal"><span class="pre">degrees()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.radians" title="mxnet.ndarray.sparse.RowSparseNDArray.radians"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.radians</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.radians" title="mxnet.ndarray.sparse.radians"><code class="xref py py-func docutils literal"><span class="pre">radians()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="hyperbolic-functions">
<span id="id8"></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.sparse.RowSparseNDArray.sinh" title="mxnet.ndarray.sparse.RowSparseNDArray.sinh"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.sinh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sinh" title="mxnet.ndarray.sparse.sinh"><code class="xref py py-func docutils literal"><span class="pre">sinh()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.tanh" title="mxnet.ndarray.sparse.RowSparseNDArray.tanh"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.tanh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tanh" title="mxnet.ndarray.sparse.tanh"><code class="xref py py-func docutils literal"><span class="pre">tanh()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.arcsinh" title="mxnet.ndarray.sparse.RowSparseNDArray.arcsinh"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.arcsinh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsinh" title="mxnet.ndarray.sparse.arcsinh"><code class="xref py py-func docutils literal"><span class="pre">arcsinh()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.arctanh" title="mxnet.ndarray.sparse.RowSparseNDArray.arctanh"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.arctanh</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctanh" title="mxnet.ndarray.sparse.arctanh"><code class="xref py py-func docutils literal"><span class="pre">arctanh()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="exponents-and-logarithms">
<span id="id9"></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.sparse.RowSparseNDArray.expm1" title="mxnet.ndarray.sparse.RowSparseNDArray.expm1"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.expm1</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.expm1" title="mxnet.ndarray.sparse.expm1"><code class="xref py py-func docutils literal"><span class="pre">expm1()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.log1p" title="mxnet.ndarray.sparse.RowSparseNDArray.log1p"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.log1p</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.log1p" title="mxnet.ndarray.sparse.log1p"><code class="xref py py-func docutils literal"><span class="pre">log1p()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="powers">
<span id="id10"></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.sparse.RowSparseNDArray.sqrt" title="mxnet.ndarray.sparse.RowSparseNDArray.sqrt"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.sqrt</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sqrt" title="mxnet.ndarray.sparse.sqrt"><code class="xref py py-func docutils literal"><span class="pre">sqrt()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.square" title="mxnet.ndarray.sparse.RowSparseNDArray.square"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.square</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="indexing">
<span id="id11"></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.sparse.RowSparseNDArray.__getitem__" title="mxnet.ndarray.sparse.RowSparseNDArray.__getitem__"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.__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.sparse.RowSparseNDArray.__setitem__" title="mxnet.ndarray.sparse.RowSparseNDArray.__setitem__"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.__setitem__</span></code></a></td>
<td>x.__setitem__(i, y) <=> x[i]=y</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.retain" title="mxnet.ndarray.sparse.RowSparseNDArray.retain"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.retain</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.retain" title="mxnet.ndarray.sparse.retain"><code class="xref py py-func docutils literal"><span class="pre">retain()</span></code></a>.</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="lazy-evaluation">
<span id="id12"></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.sparse.RowSparseNDArray.wait_to_read" title="mxnet.ndarray.sparse.RowSparseNDArray.wait_to_read"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.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 class="section" id="miscellaneous">
<span id="id13"></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.sparse.RowSparseNDArray.abs" title="mxnet.ndarray.sparse.RowSparseNDArray.abs"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.abs</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.abs" title="mxnet.ndarray.sparse.abs"><code class="xref py py-func docutils literal"><span class="pre">abs()</span></code></a>.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.clip" title="mxnet.ndarray.sparse.RowSparseNDArray.clip"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.clip</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.clip" title="mxnet.ndarray.sparse.clip"><code class="xref py py-func docutils literal"><span class="pre">clip()</span></code></a>.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray.sign" title="mxnet.ndarray.sparse.RowSparseNDArray.sign"><code class="xref py py-obj docutils literal"><span class="pre">RowSparseNDArray.sign</span></code></a></td>
<td>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sign" title="mxnet.ndarray.sparse.sign"><code class="xref py py-func docutils literal"><span class="pre">sign()</span></code></a>.</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><code class="xref py py-obj docutils literal"><span class="pre">array</span></code></td>
<td>Creates a sparse array from any object exposing the array interface.</td>
</tr>
<tr class="row-even"><td><code class="xref py py-obj docutils literal"><span class="pre">empty</span></code></td>
<td>Returns a new array of given shape and type, without initializing entries.</td>
</tr>
<tr class="row-odd"><td><code class="xref py py-obj docutils literal"><span class="pre">zeros</span></code></td>
<td>Return a new array of given shape and type, filled with zeros.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.zeros_like" title="mxnet.ndarray.sparse.zeros_like"><code class="xref py py-obj docutils literal"><span class="pre">zeros_like</span></code></a></td>
<td>Return an array of zeros with the same shape, type and storage type as the input array.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.csr_matrix" title="mxnet.ndarray.sparse.csr_matrix"><code class="xref py py-obj docutils literal"><span class="pre">csr_matrix</span></code></a></td>
<td>Creates a <cite>CSRNDArray</cite>, an 2D array with compressed sparse row (CSR) format.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.row_sparse_array" title="mxnet.ndarray.sparse.row_sparse_array"><code class="xref py py-obj docutils literal"><span class="pre">row_sparse_array</span></code></a></td>
<td>Creates a <cite>RowSparseNDArray</cite>, a multidimensional row sparse array with a set of tensor slices at given indices.</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">mxnet.ndarray.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">mxnet.ndarray.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-storage-type">
<span id="changing-array-storage-type"></span><h3>Changing array storage type<a class="headerlink" href="#changing-array-storage-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.sparse.cast_storage" title="mxnet.ndarray.sparse.cast_storage"><code class="xref py py-obj docutils literal"><span class="pre">cast_storage</span></code></a></td>
<td>Casts tensor storage type to the new type.</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.sparse.slice" title="mxnet.ndarray.sparse.slice"><code class="xref py py-obj docutils literal"><span class="pre">slice</span></code></a></td>
<td>Slices a region of the array.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.retain" title="mxnet.ndarray.sparse.retain"><code class="xref py py-obj docutils literal"><span class="pre">retain</span></code></a></td>
<td>pick rows specified by user input index array from a row sparse matrix</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.where" title="mxnet.ndarray.sparse.where"><code class="xref py py-obj docutils literal"><span class="pre">where</span></code></a></td>
<td>Return the elements, either from x or y, depending on the condition.</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="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.sparse.elemwise_add" title="mxnet.ndarray.sparse.elemwise_add"><code class="xref py py-obj docutils literal"><span class="pre">elemwise_add</span></code></a></td>
<td>Adds arguments element-wise.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.elemwise_sub" title="mxnet.ndarray.sparse.elemwise_sub"><code class="xref py py-obj docutils literal"><span class="pre">elemwise_sub</span></code></a></td>
<td>Subtracts arguments element-wise.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.elemwise_mul" title="mxnet.ndarray.sparse.elemwise_mul"><code class="xref py py-obj docutils literal"><span class="pre">elemwise_mul</span></code></a></td>
<td>Multiplies arguments element-wise.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.broadcast_add" title="mxnet.ndarray.sparse.broadcast_add"><code class="xref py py-obj docutils literal"><span class="pre">broadcast_add</span></code></a></td>
<td>Returns element-wise sum of the input arrays with broadcasting.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.broadcast_sub" title="mxnet.ndarray.sparse.broadcast_sub"><code class="xref py py-obj docutils literal"><span class="pre">broadcast_sub</span></code></a></td>
<td>Returns element-wise difference of the input arrays with broadcasting.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.broadcast_mul" title="mxnet.ndarray.sparse.broadcast_mul"><code class="xref py py-obj docutils literal"><span class="pre">broadcast_mul</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.sparse.broadcast_div" title="mxnet.ndarray.sparse.broadcast_div"><code class="xref py py-obj docutils literal"><span class="pre">broadcast_div</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.sparse.negative" title="mxnet.ndarray.sparse.negative"><code class="xref py py-obj docutils literal"><span class="pre">negative</span></code></a></td>
<td>Numerical negative of the argument, element-wise.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.dot" title="mxnet.ndarray.sparse.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.sparse.add_n" title="mxnet.ndarray.sparse.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="id14"></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.sparse.sin" title="mxnet.ndarray.sparse.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.sparse.tan" title="mxnet.ndarray.sparse.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-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.arcsin" title="mxnet.ndarray.sparse.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-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.arctan" title="mxnet.ndarray.sparse.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.sparse.degrees" title="mxnet.ndarray.sparse.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.sparse.radians" title="mxnet.ndarray.sparse.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="id15"></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.sparse.sinh" title="mxnet.ndarray.sparse.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.sparse.tanh" title="mxnet.ndarray.sparse.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-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.arcsinh" title="mxnet.ndarray.sparse.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-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.arctanh" title="mxnet.ndarray.sparse.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.sparse.sum" title="mxnet.ndarray.sparse.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.sparse.mean" title="mxnet.ndarray.sparse.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-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.norm" title="mxnet.ndarray.sparse.norm"><code class="xref py py-obj docutils literal"><span class="pre">norm</span></code></a></td>
<td>Computes the norm on an NDArray.</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.sparse.round" title="mxnet.ndarray.sparse.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.sparse.rint" title="mxnet.ndarray.sparse.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.sparse.fix" title="mxnet.ndarray.sparse.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.sparse.floor" title="mxnet.ndarray.sparse.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.sparse.ceil" title="mxnet.ndarray.sparse.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.sparse.trunc" title="mxnet.ndarray.sparse.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="id16"></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.sparse.expm1" title="mxnet.ndarray.sparse.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-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.log1p" title="mxnet.ndarray.sparse.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="id17"></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.sparse.sqrt" title="mxnet.ndarray.sparse.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-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.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="miscellaneous">
<span id="id18"></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.sparse.abs" title="mxnet.ndarray.sparse.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-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.sign" title="mxnet.ndarray.sparse.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>
</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="updater">
<span id="updater"></span><h3>Updater<a class="headerlink" href="#updater" 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.sparse.sgd_update" title="mxnet.ndarray.sparse.sgd_update"><code class="xref py py-obj docutils literal"><span class="pre">sgd_update</span></code></a></td>
<td>Update function for Stochastic Gradient Descent (SDG) optimizer.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.sgd_mom_update" title="mxnet.ndarray.sparse.sgd_mom_update"><code class="xref py py-obj docutils literal"><span class="pre">sgd_mom_update</span></code></a></td>
<td>Momentum update function for Stochastic Gradient Descent (SGD) optimizer.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.adam_update" title="mxnet.ndarray.sparse.adam_update"><code class="xref py py-obj docutils literal"><span class="pre">adam_update</span></code></a></td>
<td>Update function for Adam optimizer.</td>
</tr>
<tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.adagrad_update" title="mxnet.ndarray.sparse.adagrad_update"><code class="xref py py-obj docutils literal"><span class="pre">adagrad_update</span></code></a></td>
<td>Update function for AdaGrad optimizer.</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.sparse.make_loss" title="mxnet.ndarray.sparse.make_loss"><code class="xref py py-obj docutils literal"><span class="pre">make_loss</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.sparse.stop_gradient" title="mxnet.ndarray.sparse.stop_gradient"><code class="xref py py-obj docutils literal"><span class="pre">stop_gradient</span></code></a></td>
<td>Stops gradient computation.</td>
</tr>
<tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.sparse.Embedding" title="mxnet.ndarray.sparse.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-even"><td><a class="reference internal" href="#mxnet.ndarray.sparse.LinearRegressionOutput" title="mxnet.ndarray.sparse.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.sparse.LogisticRegressionOutput" title="mxnet.ndarray.sparse.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>
</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><dl class="class">
<dt id="mxnet.ndarray.sparse.CSRNDArray">
<em class="property">class </em><code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">CSRNDArray</code><span class="sig-paren">(</span><em>handle</em>, <em>writable=True</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#CSRNDArray"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray" title="Permalink to this definition"></a></dt>
<dd><p>A sparse representation of 2D NDArray in the Compressed Sparse Row format.</p>
<p>A CSRNDArray represents an NDArray as three separate arrays: <cite>data</cite>,
<cite>indptr</cite> and <cite>indices</cite>. It uses the CSR representation where the column indices for
row i are stored in <code class="docutils literal"><span class="pre">indices[indptr[i]:indptr[i+1]]</span></code> and their corresponding values are stored
in <code class="docutils literal"><span class="pre">data[indptr[i]:indptr[i+1]]</span></code>.</p>
<p>The column indices for a given row are expected to be sorted in ascending order.
Duplicate column entries for the same row are not allowed.</p>
<p class="rubric">Example</p>
<div class="highlight-default"><div class="highlight"><pre><span></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">array</span><span class="p">([[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</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">0</span><span class="p">],</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">0</span><span class="p">],</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">3</span><span class="p">]])</span>
<span class="gp">>>> </span><span class="n">a</span> <span class="o">=</span> <span class="n">a</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">a</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([ 1., 2., 3.], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">a</span><span class="o">.</span><span class="n">indices</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([1, 0, 2])</span>
<span class="gp">>>> </span><span class="n">a</span><span class="o">.</span><span class="n">indptr</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([0, 1, 2, 2, 3])</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="#mxnet.ndarray.sparse.csr_matrix" title="mxnet.ndarray.sparse.csr_matrix"><code class="xref py py-class docutils literal"><span class="pre">csr_matrix</span></code></a></dt>
<dd>Several ways to construct a CSRNDArray</dd>
</dl>
</div>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.__getitem__">
<code class="descname">__getitem__</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#CSRNDArray.__getitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.__getitem__" title="Permalink to this definition"></a></dt>
<dd><p>x.__getitem__(i) <=> x[i]</p>
<p>Returns a newly created NDArray based on the indexing key.</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</em><em> or </em><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray.slice" title="mxnet.ndarray.NDArray.slice"><em>mxnet.ndarray.NDArray.slice</em></a>) – Indexing key.</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">indptr</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">6</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">indices</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</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">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">data</span> <span class="o">=</span> <span class="n">np</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="mi">5</span><span class="p">,</span> <span class="mi">6</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">sparse</span><span class="o">.</span><span class="n">csr_matrix</span><span class="p">((</span><span class="n">data</span><span class="p">,</span> <span class="n">indices</span><span class="p">,</span> <span class="n">indptr</span><span class="p">),</span> <span class="n">shape</span><span class="o">=</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">a</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 0., 2.],</span>
<span class="go"> [ 0., 0., 3.],</span>
<span class="go"> [ 4., 5., 6.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">a</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="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">a</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., 0., 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">a</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">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 4., 5., 6.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.__setitem__">
<code class="descname">__setitem__</code><span class="sig-paren">(</span><em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#CSRNDArray.__setitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.__setitem__" title="Permalink to this definition"></a></dt>
<dd><p>x.__setitem__(i, y) <=> x[i]=y</p>
<p>Set self[key] to value. Only slice key [:] is supported.</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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray.slice" title="mxnet.ndarray.NDArray.slice"><em>mxnet.ndarray.NDArray.slice</em></a>) – The indexing key.</li>
<li><strong>value</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><em>CSRNDArray</em></a><em> or </em><em>numpy.ndarray</em>) – The value to set.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">src</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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">,</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">src</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.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="c1"># assign CSRNDArray with same storage type</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">3</span><span class="p">,</span><span class="mi">3</span><span class="p">))</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">x</span><span class="p">[:]</span> <span class="o">=</span> <span class="n">src</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.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="c1"># assign NDArray to CSRNDArray</span>
<span class="gp">>>> </span><span class="n">x</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">ones</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="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"> [ 2., 2., 2.],</span>
<span class="go"> [ 2., 2., 2.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.CSRNDArray.indices">
<code class="descname">indices</code><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.indices" title="Permalink to this definition"></a></dt>
<dd><p>A deep copy NDArray of the indices array of the CSRNDArray.
This generates a deep copy of the column indices of the current <cite>csr</cite> matrix.</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 CSRNDArray’s indices array.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.CSRNDArray.indptr">
<code class="descname">indptr</code><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.indptr" title="Permalink to this definition"></a></dt>
<dd><p>A deep copy NDArray of the indptr array of the CSRNDArray.
This generates a deep copy of the <cite>indptr</cite> of the current <cite>csr</cite> matrix.</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 CSRNDArray’s indptr array.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.CSRNDArray.data">
<code class="descname">data</code><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.data" title="Permalink to this definition"></a></dt>
<dd><p>A deep copy NDArray of the data array of the CSRNDArray.
This generates a deep copy of the <cite>data</cite> of the current <cite>csr</cite> matrix.</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 CSRNDArray’s data array.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.tostype">
<code class="descname">tostype</code><span class="sig-paren">(</span><em>stype</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#CSRNDArray.tostype"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.tostype" title="Permalink to this definition"></a></dt>
<dd><p>Return a copy of the array with chosen storage 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">Returns:</th><td class="field-body">A copy of the array with the chosen storage stype</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.copyto">
<code class="descname">copyto</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#CSRNDArray.copyto"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.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> or <code class="docutils literal"><span class="pre">CSRNDArray</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">CSRNDArray</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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><em>CSRNDArray</em></a><em> or </em><em>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> or <code class="docutils literal"><span class="pre">CSRNDArray</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> or <code class="docutils literal"><span class="pre">CSRNDArray</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.asscipy">
<code class="descname">asscipy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#CSRNDArray.asscipy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.asscipy" title="Permalink to this definition"></a></dt>
<dd><p>Returns a <code class="docutils literal"><span class="pre">scipy.sparse.csr.csr_matrix</span></code> object with value copied from this array</p>
<p class="rubric">Examples</p>
<div class="highlight-default"><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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">,</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">asscipy</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 'scipy.sparse.csr.csr_matrix'></span>
<span class="gp">>>> </span><span class="n">y</span>
<span class="go"><2x3 sparse matrix of type '<type 'numpy.float32'>'</span>
<span class="go">with 0 stored elements in Compressed Sparse Row format></span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.__neg__">
<code class="descname">__neg__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.__neg__" title="Permalink to this definition"></a></dt>
<dd><p>x.__neg__(y) <=> -x</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.abs">
<code class="descname">abs</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.abs" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.abs" title="mxnet.ndarray.sparse.abs"><code class="xref py py-func docutils literal"><span class="pre">abs()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.abs" title="mxnet.ndarray.sparse.abs"><code class="xref py py-func docutils literal"><span class="pre">abs()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.arcsin">
<code class="descname">arcsin</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.arcsin" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsin" title="mxnet.ndarray.sparse.arcsin"><code class="xref py py-func docutils literal"><span class="pre">arcsin()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsin" title="mxnet.ndarray.sparse.arcsin"><code class="xref py py-func docutils literal"><span class="pre">arcsin()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.arcsinh">
<code class="descname">arcsinh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.arcsinh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsinh" title="mxnet.ndarray.sparse.arcsinh"><code class="xref py py-func docutils literal"><span class="pre">arcsinh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsinh" title="mxnet.ndarray.sparse.arcsinh"><code class="xref py py-func docutils literal"><span class="pre">arcsinh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.arctan">
<code class="descname">arctan</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.arctan" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctan" title="mxnet.ndarray.sparse.arctan"><code class="xref py py-func docutils literal"><span class="pre">arctan()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arctan" title="mxnet.ndarray.sparse.arctan"><code class="xref py py-func docutils literal"><span class="pre">arctan()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.arctanh">
<code class="descname">arctanh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.arctanh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctanh" title="mxnet.ndarray.sparse.arctanh"><code class="xref py py-func docutils literal"><span class="pre">arctanh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arctanh" title="mxnet.ndarray.sparse.arctanh"><code class="xref py py-func docutils literal"><span class="pre">arctanh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.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.sparse.CSRNDArray.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a>, <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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.sparse.CSRNDArray.asnumpy">
<code class="descname">asnumpy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.asnumpy" title="Permalink to this definition"></a></dt>
<dd><p>Return a dense <code class="docutils literal"><span class="pre">numpy.ndarray</span></code> object with value copied from this array</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.asscalar">
<code class="descname">asscalar</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.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-default"><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.sparse.CSRNDArray.astype">
<code class="descname">astype</code><span class="sig-paren">(</span><em>dtype</em>, <em>copy=True</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.astype" title="Permalink to this definition"></a></dt>
<dd><p>Return 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"><ul class="first last simple">
<li><strong>dtype</strong> (<em>numpy.dtype</em><em> or </em><em>str</em>) – The type of the returned array.</li>
<li><strong>copy</strong> (<em>bool</em>) – Default <cite>True</cite>. By default, astype always returns a newly
allocated ndarray on the same context. If this is set to
<cite>False</cite>, and the dtype requested is the same as the ndarray’s
dtype, the ndarray is returned instead of a copy.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">,</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.sparse.CSRNDArray.ceil">
<code class="descname">ceil</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.ceil" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.ceil" title="mxnet.ndarray.sparse.ceil"><code class="xref py py-func docutils literal"><span class="pre">ceil()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.ceil" title="mxnet.ndarray.sparse.ceil"><code class="xref py py-func docutils literal"><span class="pre">ceil()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.check_format">
<code class="descname">check_format</code><span class="sig-paren">(</span><em>full_check=True</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.check_format" title="Permalink to this definition"></a></dt>
<dd><p>Check whether the NDArray format is valid.</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>full_check</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>True</cite>, rigorous check, O(N) operations. Otherwise
basic check, O(1) operations (default True).</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.clip">
<code class="descname">clip</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.clip" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.clip" title="mxnet.ndarray.sparse.clip"><code class="xref py py-func docutils literal"><span class="pre">clip()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.clip" title="mxnet.ndarray.sparse.clip"><code class="xref py py-func docutils literal"><span class="pre">clip()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.CSRNDArray.context">
<code class="descname">context</code><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.context" title="Permalink to this definition"></a></dt>
<dd><p>Device context of the array.</p>
<p class="rubric">Examples</p>
<div class="highlight-default"><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="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a>, <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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.sparse.CSRNDArray.degrees">
<code class="descname">degrees</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.degrees" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.degrees" title="mxnet.ndarray.sparse.degrees"><code class="xref py py-func docutils literal"><span class="pre">degrees()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.degrees" title="mxnet.ndarray.sparse.degrees"><code class="xref py py-func docutils literal"><span class="pre">degrees()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.CSRNDArray.dtype">
<code class="descname">dtype</code><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.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-default"><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="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.expm1">
<code class="descname">expm1</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.expm1" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.expm1" title="mxnet.ndarray.sparse.expm1"><code class="xref py py-func docutils literal"><span class="pre">expm1()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.expm1" title="mxnet.ndarray.sparse.expm1"><code class="xref py py-func docutils literal"><span class="pre">expm1()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.fix">
<code class="descname">fix</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.fix" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.fix" title="mxnet.ndarray.sparse.fix"><code class="xref py py-func docutils literal"><span class="pre">fix()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.fix" title="mxnet.ndarray.sparse.fix"><code class="xref py py-func docutils literal"><span class="pre">fix()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.floor">
<code class="descname">floor</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.floor" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.floor" title="mxnet.ndarray.sparse.floor"><code class="xref py py-func docutils literal"><span class="pre">floor()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.floor" title="mxnet.ndarray.sparse.floor"><code class="xref py py-func docutils literal"><span class="pre">floor()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.log1p">
<code class="descname">log1p</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.log1p" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.log1p" title="mxnet.ndarray.sparse.log1p"><code class="xref py py-func docutils literal"><span class="pre">log1p()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.log1p" title="mxnet.ndarray.sparse.log1p"><code class="xref py py-func docutils literal"><span class="pre">log1p()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.mean">
<code class="descname">mean</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.mean" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.mean" title="mxnet.ndarray.sparse.mean"><code class="xref py py-func docutils literal"><span class="pre">mean()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.mean" title="mxnet.ndarray.sparse.mean"><code class="xref py py-func docutils literal"><span class="pre">mean()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.norm">
<code class="descname">norm</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.norm" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.norm" title="mxnet.ndarray.sparse.norm"><code class="xref py py-func docutils literal"><span class="pre">norm()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.norm" title="mxnet.ndarray.sparse.norm"><code class="xref py py-func docutils literal"><span class="pre">norm()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.radians">
<code class="descname">radians</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.radians" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.radians" title="mxnet.ndarray.sparse.radians"><code class="xref py py-func docutils literal"><span class="pre">radians()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.radians" title="mxnet.ndarray.sparse.radians"><code class="xref py py-func docutils literal"><span class="pre">radians()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.rint">
<code class="descname">rint</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.rint" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.rint" title="mxnet.ndarray.sparse.rint"><code class="xref py py-func docutils literal"><span class="pre">rint()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.rint" title="mxnet.ndarray.sparse.rint"><code class="xref py py-func docutils literal"><span class="pre">rint()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.round">
<code class="descname">round</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.round" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.round" title="mxnet.ndarray.sparse.round"><code class="xref py py-func docutils literal"><span class="pre">round()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.round" title="mxnet.ndarray.sparse.round"><code class="xref py py-func docutils literal"><span class="pre">round()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.CSRNDArray.shape">
<code class="descname">shape</code><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.shape" title="Permalink to this definition"></a></dt>
<dd><p>Tuple of array dimensions.</p>
<p class="rubric">Examples</p>
<div class="highlight-default"><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="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.sign">
<code class="descname">sign</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.sign" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sign" title="mxnet.ndarray.sparse.sign"><code class="xref py py-func docutils literal"><span class="pre">sign()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sign" title="mxnet.ndarray.sparse.sign"><code class="xref py py-func docutils literal"><span class="pre">sign()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.sin">
<code class="descname">sin</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.sin" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sin" title="mxnet.ndarray.sparse.sin"><code class="xref py py-func docutils literal"><span class="pre">sin()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sin" title="mxnet.ndarray.sparse.sin"><code class="xref py py-func docutils literal"><span class="pre">sin()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.sinh">
<code class="descname">sinh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.sinh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sinh" title="mxnet.ndarray.sparse.sinh"><code class="xref py py-func docutils literal"><span class="pre">sinh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sinh" title="mxnet.ndarray.sparse.sinh"><code class="xref py py-func docutils literal"><span class="pre">sinh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.slice">
<code class="descname">slice</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.slice" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.slice" title="mxnet.ndarray.sparse.slice"><code class="xref py py-func docutils literal"><span class="pre">slice()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.slice" title="mxnet.ndarray.sparse.slice"><code class="xref py py-func docutils literal"><span class="pre">slice()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.sqrt">
<code class="descname">sqrt</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.sqrt" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sqrt" title="mxnet.ndarray.sparse.sqrt"><code class="xref py py-func docutils literal"><span class="pre">sqrt()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sqrt" title="mxnet.ndarray.sparse.sqrt"><code class="xref py py-func docutils literal"><span class="pre">sqrt()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.square">
<code class="descname">square</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.square" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">square</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.CSRNDArray.stype">
<code class="descname">stype</code><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.stype" title="Permalink to this definition"></a></dt>
<dd><p>Storage-type of the array.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.sum">
<code class="descname">sum</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.sum" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sum" title="mxnet.ndarray.sparse.sum"><code class="xref py py-func docutils literal"><span class="pre">sum()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sum" title="mxnet.ndarray.sparse.sum"><code class="xref py py-func docutils literal"><span class="pre">sum()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.tan">
<code class="descname">tan</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.tan" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tan" title="mxnet.ndarray.sparse.tan"><code class="xref py py-func docutils literal"><span class="pre">tan()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.tan" title="mxnet.ndarray.sparse.tan"><code class="xref py py-func docutils literal"><span class="pre">tan()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.tanh">
<code class="descname">tanh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.tanh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tanh" title="mxnet.ndarray.sparse.tanh"><code class="xref py py-func docutils literal"><span class="pre">tanh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.tanh" title="mxnet.ndarray.sparse.tanh"><code class="xref py py-func docutils literal"><span class="pre">tanh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.trunc">
<code class="descname">trunc</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.trunc" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.trunc" title="mxnet.ndarray.sparse.trunc"><code class="xref py py-func docutils literal"><span class="pre">trunc()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.trunc" title="mxnet.ndarray.sparse.trunc"><code class="xref py py-func docutils literal"><span class="pre">trunc()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.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.sparse.CSRNDArray.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-default"><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="nb">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="nb">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="method">
<dt id="mxnet.ndarray.sparse.CSRNDArray.zeros_like">
<code class="descname">zeros_like</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.CSRNDArray.zeros_like" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.zeros_like" title="mxnet.ndarray.sparse.zeros_like"><code class="xref py py-func docutils literal"><span class="pre">zeros_like()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.zeros_like" title="mxnet.ndarray.sparse.zeros_like"><code class="xref py py-func docutils literal"><span class="pre">zeros_like()</span></code></a>, with
this array as data.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray">
<em class="property">class </em><code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">RowSparseNDArray</code><span class="sig-paren">(</span><em>handle</em>, <em>writable=True</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#RowSparseNDArray"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="Permalink to this definition"></a></dt>
<dd><p>A sparse representation of a set of NDArray row slices at given indices.</p>
<p>A RowSparseNDArray represents a multidimensional NDArray using two separate arrays: <cite>data</cite> and
<cite>indices</cite>. The number of dimensions has to be at least 2.</p>
<ul class="simple">
<li>data: an NDArray of any dtype with shape [D0, D1, ..., Dn].</li>
<li>indices: a 1-D int64 NDArray with shape [D0] with values sorted in ascending order.</li>
</ul>
<p>The <cite>indices</cite> stores the indices of the row slices with non-zeros,
while the values are stored in <cite>data</cite>. The corresponding NDArray <code class="docutils literal"><span class="pre">dense</span></code>
represented by RowSparseNDArray <code class="docutils literal"><span class="pre">rsp</span></code> has</p>
<p><code class="docutils literal"><span class="pre">dense[rsp.indices[i],</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">...]</span> <span class="pre">=</span> <span class="pre">rsp.data[i,</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">...]</span></code></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">dense</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 2., 3.],</span>
<span class="go"> [ 0., 0., 0.],</span>
<span class="go"> [ 4., 0., 5.],</span>
<span class="go"> [ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">rsp</span> <span class="o">=</span> <span class="n">dense</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">rsp</span><span class="o">.</span><span class="n">indices</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([0, 2], dtype=int64)</span>
<span class="gp">>>> </span><span class="n">rsp</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 2., 3.],</span>
<span class="go"> [ 4., 0., 5.]], dtype=float32)</span>
</pre></div>
</div>
<p>A RowSparseNDArray is typically used to represent non-zero row slices of a large NDArray
of shape [LARGE0, D1, .. , Dn] where LARGE0 >> D0 and most row slices are zeros.</p>
<p>RowSparseNDArray is used principally in the definition of gradients for operations
that have sparse gradients (e.g. sparse dot and sparse embedding).</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="#mxnet.ndarray.sparse.row_sparse_array" title="mxnet.ndarray.sparse.row_sparse_array"><code class="xref py py-class docutils literal"><span class="pre">row_sparse_array</span></code></a></dt>
<dd>Several ways to construct a RowSparseNDArray</dd>
</dl>
</div>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.__getitem__">
<code class="descname">__getitem__</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#RowSparseNDArray.__getitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.__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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray.slice" title="mxnet.ndarray.NDArray.slice"><em>mxnet.ndarray.NDArray.slice</em></a>) – Indexing key.</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">,</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="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.__setitem__">
<code class="descname">__setitem__</code><span class="sig-paren">(</span><em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#RowSparseNDArray.__setitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.__setitem__" title="Permalink to this definition"></a></dt>
<dd><p>x.__setitem__(i, y) <=> x[i]=y</p>
<p>Set self[key] to value. Only slice key [:] is supported.</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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray.slice" title="mxnet.ndarray.NDArray.slice"><em>mxnet.ndarray.NDArray.slice</em></a>) – The indexing key.</li>
<li><strong>value</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><em>numpy.ndarray</em>) – The value to set.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">src</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">row_sparse</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="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">0</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">3</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">src</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 1., 0., 2.],</span>
<span class="go"> [ 0., 0., 0.],</span>
<span class="go"> [ 4., 5., 6.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="c1"># assign RowSparseNDArray with same storage type</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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">,</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">x</span><span class="p">[:]</span> <span class="o">=</span> <span class="n">src</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., 0., 2.],</span>
<span class="go"> [ 0., 0., 0.],</span>
<span class="go"> [ 4., 5., 6.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="c1"># assign NDArray to RowSparseNDArray</span>
<span class="gp">>>> </span><span class="n">x</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">ones</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">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.],</span>
<span class="go"> [ 1., 1., 1.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.indices">
<code class="descname">indices</code><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.indices" title="Permalink to this definition"></a></dt>
<dd><p>A deep copy NDArray of the indices array of the RowSparseNDArray.
This generates a deep copy of the row indices of the current <cite>row_sparse</cite> matrix.</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 RowSparseNDArray’s indices array.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.data">
<code class="descname">data</code><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.data" title="Permalink to this definition"></a></dt>
<dd><p>A deep copy NDArray of the data array of the RowSparseNDArray.
This generates a deep copy of the <cite>data</cite> of the current <cite>row_sparse</cite> matrix.</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 RowSparseNDArray’s data array.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.tostype">
<code class="descname">tostype</code><span class="sig-paren">(</span><em>stype</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#RowSparseNDArray.tostype"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.tostype" title="Permalink to this definition"></a></dt>
<dd><p>Return a copy of the array with chosen storage 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">Returns:</th><td class="field-body">A copy of the array with the chosen storage stype</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.copyto">
<code class="descname">copyto</code><span class="sig-paren">(</span><em>other</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#RowSparseNDArray.copyto"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.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> or <code class="docutils literal"><span class="pre">RowSparseNDArray</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">RowSparseNDArray</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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><em>RowSparseNDArray</em></a><em> or </em><em>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> or <code class="docutils literal"><span class="pre">RowSparseNDArray</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> or <code class="docutils literal"><span class="pre">RowSparseNDArray</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.retain">
<code class="descname">retain</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#RowSparseNDArray.retain"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.retain" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.retain" title="mxnet.ndarray.sparse.retain"><code class="xref py py-func docutils literal"><span class="pre">retain()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.retain" title="mxnet.ndarray.sparse.retain"><code class="xref py py-func docutils literal"><span class="pre">retain()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.abs">
<code class="descname">abs</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.abs" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.abs" title="mxnet.ndarray.sparse.abs"><code class="xref py py-func docutils literal"><span class="pre">abs()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.abs" title="mxnet.ndarray.sparse.abs"><code class="xref py py-func docutils literal"><span class="pre">abs()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.arcsin">
<code class="descname">arcsin</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.arcsin" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsin" title="mxnet.ndarray.sparse.arcsin"><code class="xref py py-func docutils literal"><span class="pre">arcsin()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsin" title="mxnet.ndarray.sparse.arcsin"><code class="xref py py-func docutils literal"><span class="pre">arcsin()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.arcsinh">
<code class="descname">arcsinh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.arcsinh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsinh" title="mxnet.ndarray.sparse.arcsinh"><code class="xref py py-func docutils literal"><span class="pre">arcsinh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arcsinh" title="mxnet.ndarray.sparse.arcsinh"><code class="xref py py-func docutils literal"><span class="pre">arcsinh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.arctan">
<code class="descname">arctan</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.arctan" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctan" title="mxnet.ndarray.sparse.arctan"><code class="xref py py-func docutils literal"><span class="pre">arctan()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arctan" title="mxnet.ndarray.sparse.arctan"><code class="xref py py-func docutils literal"><span class="pre">arctan()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.arctanh">
<code class="descname">arctanh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.arctanh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.arctanh" title="mxnet.ndarray.sparse.arctanh"><code class="xref py py-func docutils literal"><span class="pre">arctanh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.arctanh" title="mxnet.ndarray.sparse.arctanh"><code class="xref py py-func docutils literal"><span class="pre">arctanh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.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.sparse.RowSparseNDArray.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a>, <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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.sparse.RowSparseNDArray.asnumpy">
<code class="descname">asnumpy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.asnumpy" title="Permalink to this definition"></a></dt>
<dd><p>Return a dense <code class="docutils literal"><span class="pre">numpy.ndarray</span></code> object with value copied from this array</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.asscalar">
<code class="descname">asscalar</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.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-default"><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.sparse.RowSparseNDArray.astype">
<code class="descname">astype</code><span class="sig-paren">(</span><em>dtype</em>, <em>copy=True</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.astype" title="Permalink to this definition"></a></dt>
<dd><p>Return 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"><ul class="first last simple">
<li><strong>dtype</strong> (<em>numpy.dtype</em><em> or </em><em>str</em>) – The type of the returned array.</li>
<li><strong>copy</strong> (<em>bool</em>) – Default <cite>True</cite>. By default, astype always returns a newly
allocated ndarray on the same context. If this is set to
<cite>False</cite>, and the dtype requested is the same as the ndarray’s
dtype, the ndarray is returned instead of a copy.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">,</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.sparse.RowSparseNDArray.ceil">
<code class="descname">ceil</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.ceil" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.ceil" title="mxnet.ndarray.sparse.ceil"><code class="xref py py-func docutils literal"><span class="pre">ceil()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.ceil" title="mxnet.ndarray.sparse.ceil"><code class="xref py py-func docutils literal"><span class="pre">ceil()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.check_format">
<code class="descname">check_format</code><span class="sig-paren">(</span><em>full_check=True</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.check_format" title="Permalink to this definition"></a></dt>
<dd><p>Check whether the NDArray format is valid.</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>full_check</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>True</cite>, rigorous check, O(N) operations. Otherwise
basic check, O(1) operations (default True).</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.clip">
<code class="descname">clip</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.clip" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.clip" title="mxnet.ndarray.sparse.clip"><code class="xref py py-func docutils literal"><span class="pre">clip()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.clip" title="mxnet.ndarray.sparse.clip"><code class="xref py py-func docutils literal"><span class="pre">clip()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.context">
<code class="descname">context</code><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.context" title="Permalink to this definition"></a></dt>
<dd><p>Device context of the array.</p>
<p class="rubric">Examples</p>
<div class="highlight-default"><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="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a>, <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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.sparse.RowSparseNDArray.degrees">
<code class="descname">degrees</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.degrees" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.degrees" title="mxnet.ndarray.sparse.degrees"><code class="xref py py-func docutils literal"><span class="pre">degrees()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.degrees" title="mxnet.ndarray.sparse.degrees"><code class="xref py py-func docutils literal"><span class="pre">degrees()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.dtype">
<code class="descname">dtype</code><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.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-default"><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="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.expm1">
<code class="descname">expm1</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.expm1" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.expm1" title="mxnet.ndarray.sparse.expm1"><code class="xref py py-func docutils literal"><span class="pre">expm1()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.expm1" title="mxnet.ndarray.sparse.expm1"><code class="xref py py-func docutils literal"><span class="pre">expm1()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.fix">
<code class="descname">fix</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.fix" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.fix" title="mxnet.ndarray.sparse.fix"><code class="xref py py-func docutils literal"><span class="pre">fix()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.fix" title="mxnet.ndarray.sparse.fix"><code class="xref py py-func docutils literal"><span class="pre">fix()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.floor">
<code class="descname">floor</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.floor" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.floor" title="mxnet.ndarray.sparse.floor"><code class="xref py py-func docutils literal"><span class="pre">floor()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.floor" title="mxnet.ndarray.sparse.floor"><code class="xref py py-func docutils literal"><span class="pre">floor()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.log1p">
<code class="descname">log1p</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.log1p" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.log1p" title="mxnet.ndarray.sparse.log1p"><code class="xref py py-func docutils literal"><span class="pre">log1p()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.log1p" title="mxnet.ndarray.sparse.log1p"><code class="xref py py-func docutils literal"><span class="pre">log1p()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.norm">
<code class="descname">norm</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.norm" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.norm" title="mxnet.ndarray.sparse.norm"><code class="xref py py-func docutils literal"><span class="pre">norm()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.norm" title="mxnet.ndarray.sparse.norm"><code class="xref py py-func docutils literal"><span class="pre">norm()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.radians">
<code class="descname">radians</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.radians" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.radians" title="mxnet.ndarray.sparse.radians"><code class="xref py py-func docutils literal"><span class="pre">radians()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.radians" title="mxnet.ndarray.sparse.radians"><code class="xref py py-func docutils literal"><span class="pre">radians()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.rint">
<code class="descname">rint</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.rint" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.rint" title="mxnet.ndarray.sparse.rint"><code class="xref py py-func docutils literal"><span class="pre">rint()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.rint" title="mxnet.ndarray.sparse.rint"><code class="xref py py-func docutils literal"><span class="pre">rint()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.round">
<code class="descname">round</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.round" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.round" title="mxnet.ndarray.sparse.round"><code class="xref py py-func docutils literal"><span class="pre">round()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.round" title="mxnet.ndarray.sparse.round"><code class="xref py py-func docutils literal"><span class="pre">round()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.shape">
<code class="descname">shape</code><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.shape" title="Permalink to this definition"></a></dt>
<dd><p>Tuple of array dimensions.</p>
<p class="rubric">Examples</p>
<div class="highlight-default"><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="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.sign">
<code class="descname">sign</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.sign" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sign" title="mxnet.ndarray.sparse.sign"><code class="xref py py-func docutils literal"><span class="pre">sign()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sign" title="mxnet.ndarray.sparse.sign"><code class="xref py py-func docutils literal"><span class="pre">sign()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.sin">
<code class="descname">sin</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.sin" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sin" title="mxnet.ndarray.sparse.sin"><code class="xref py py-func docutils literal"><span class="pre">sin()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sin" title="mxnet.ndarray.sparse.sin"><code class="xref py py-func docutils literal"><span class="pre">sin()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.sinh">
<code class="descname">sinh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.sinh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sinh" title="mxnet.ndarray.sparse.sinh"><code class="xref py py-func docutils literal"><span class="pre">sinh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sinh" title="mxnet.ndarray.sparse.sinh"><code class="xref py py-func docutils literal"><span class="pre">sinh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.sqrt">
<code class="descname">sqrt</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.sqrt" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.sqrt" title="mxnet.ndarray.sparse.sqrt"><code class="xref py py-func docutils literal"><span class="pre">sqrt()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.sqrt" title="mxnet.ndarray.sparse.sqrt"><code class="xref py py-func docutils literal"><span class="pre">sqrt()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.square">
<code class="descname">square</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.square" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.square" title="mxnet.ndarray.sparse.square"><code class="xref py py-func docutils literal"><span class="pre">square()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="attribute">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.stype">
<code class="descname">stype</code><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.stype" title="Permalink to this definition"></a></dt>
<dd><p>Storage-type of the array.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.tan">
<code class="descname">tan</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.tan" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tan" title="mxnet.ndarray.sparse.tan"><code class="xref py py-func docutils literal"><span class="pre">tan()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.tan" title="mxnet.ndarray.sparse.tan"><code class="xref py py-func docutils literal"><span class="pre">tan()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.tanh">
<code class="descname">tanh</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.tanh" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.tanh" title="mxnet.ndarray.sparse.tanh"><code class="xref py py-func docutils literal"><span class="pre">tanh()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.tanh" title="mxnet.ndarray.sparse.tanh"><code class="xref py py-func docutils literal"><span class="pre">tanh()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.trunc">
<code class="descname">trunc</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.trunc" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.trunc" title="mxnet.ndarray.sparse.trunc"><code class="xref py py-func docutils literal"><span class="pre">trunc()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.trunc" title="mxnet.ndarray.sparse.trunc"><code class="xref py py-func docutils literal"><span class="pre">trunc()</span></code></a>, with
this array as data.</p>
</dd></dl>
<dl class="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.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.sparse.RowSparseNDArray.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-default"><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="nb">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="nb">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="method">
<dt id="mxnet.ndarray.sparse.RowSparseNDArray.zeros_like">
<code class="descname">zeros_like</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.RowSparseNDArray.zeros_like" title="Permalink to this definition"></a></dt>
<dd><p>Convenience fluent method for <a class="reference internal" href="#mxnet.ndarray.sparse.zeros_like" title="mxnet.ndarray.sparse.zeros_like"><code class="xref py py-func docutils literal"><span class="pre">zeros_like()</span></code></a>.</p>
<p>The arguments are the same as for <a class="reference internal" href="#mxnet.ndarray.sparse.zeros_like" title="mxnet.ndarray.sparse.zeros_like"><code class="xref py py-func docutils literal"><span class="pre">zeros_like()</span></code></a>, with
this array as data.</p>
</dd></dl>
</dd></dl>
<span class="target" id="module-mxnet.ndarray.sparse"></span><p>Sparse NDArray API of MXNet.</p>
<dl class="function">
<dt id="mxnet.ndarray.sparse.csr_matrix">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">csr_matrix</code><span class="sig-paren">(</span><em>arg1</em>, <em>shape=None</em>, <em>ctx=None</em>, <em>dtype=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#csr_matrix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.csr_matrix" title="Permalink to this definition"></a></dt>
<dd><p>Creates a <cite>CSRNDArray</cite>, an 2D array with compressed sparse row (CSR) format.</p>
<p>The CSRNDArray can be instantiated in several ways:</p>
<ul class="simple">
<li><dl class="first docutils">
<dt>csr_matrix(D):</dt>
<dd><dl class="first last docutils">
<dt>to construct a CSRNDArray with a dense 2D array <code class="docutils literal"><span class="pre">D</span></code></dt>
<dd><ul class="first last">
<li><strong>D</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">D.dtype</span></code> if <code class="docutils literal"><span class="pre">D</span></code> is an NDArray or numpy.ndarray, float32 otherwise.</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>csr_matrix(S)</dt>
<dd><dl class="first last docutils">
<dt>to construct a CSRNDArray with a sparse 2D array <code class="docutils literal"><span class="pre">S</span></code></dt>
<dd><ul class="first last">
<li><strong>S</strong> (<em>CSRNDArray or scipy.sparse.csr.csr_matrix</em>) - A sparse matrix.</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">S.dtype</span></code>.</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>csr_matrix((M, N))</dt>
<dd><dl class="first last docutils">
<dt>to construct an empty CSRNDArray with shape <code class="docutils literal"><span class="pre">(M,</span> <span class="pre">N)</span></code></dt>
<dd><ul class="first last">
<li><strong>M</strong> (<em>int</em>) - Number of rows in the matrix</li>
<li><strong>N</strong> (<em>int</em>) - Number of columns in the matrix</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 float32.</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>csr_matrix((data, indices, indptr))</dt>
<dd><dl class="first last docutils">
<dt>to construct a CSRNDArray based on the definition of compressed sparse row format using three separate arrays, where the column indices for row i are stored in <code class="docutils literal"><span class="pre">indices[indptr[i]:indptr[i+1]]</span></code> and their corresponding values are stored in <code class="docutils literal"><span class="pre">data[indptr[i]:indptr[i+1]]</span></code>. The column indices for a given row are expected to be <strong>sorted in ascending order.</strong> Duplicate column entries for the same row are not allowed.</dt>
<dd><ul class="first last">
<li><strong>data</strong> (<em>array_like</em>) - An object exposing the array interface, which holds all the non-zero entries of the matrix in row-major order.</li>
<li><strong>indices</strong> (<em>array_like</em>) - An object exposing the array interface, which stores the column index for each non-zero element in <code class="docutils literal"><span class="pre">data</span></code>.</li>
<li><strong>indptr</strong> (<em>array_like</em>) - An object exposing the array interface, which stores the offset into <code class="docutils literal"><span class="pre">data</span></code> of the first non-zero element number of each row of the matrix.</li>
<li><strong>shape</strong> (<em>tuple of int, optional</em>) - The shape of the array. The default shape is inferred from the indices and indptr arrays.</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">data.dtype</span></code> if <code class="docutils literal"><span class="pre">data</span></code> is an NDArray or numpy.ndarray, float32 otherwise.</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>csr_matrix((data, (row, col)))</dt>
<dd><dl class="first last docutils">
<dt>to construct a CSRNDArray based on the COOrdinate format using three seperate arrays, where <code class="docutils literal"><span class="pre">row[i]</span></code> is the row index of the element, <code class="docutils literal"><span class="pre">col[i]</span></code> is the column index of the element and <code class="docutils literal"><span class="pre">data[i]</span></code> is the data corresponding to the element. All the missing elements in the input are taken to be zeroes.</dt>
<dd><ul class="first last">
<li><strong>data</strong> (<em>array_like</em>) - An object exposing the array interface, which holds all the non-zero entries of the matrix in COO format.</li>
<li><strong>row</strong> (<em>array_like</em>) - An object exposing the array interface, which stores the row index for each non zero element in <code class="docutils literal"><span class="pre">data</span></code>.</li>
<li><strong>col</strong> (<em>array_like</em>) - An object exposing the array interface, which stores the col index for each non zero element in <code class="docutils literal"><span class="pre">data</span></code>.</li>
<li><strong>shape</strong> (<em>tuple of int, optional</em>) - The shape of the array. The default shape is inferred from the <code class="docutils literal"><span class="pre">row</span></code> and <code class="docutils literal"><span class="pre">col</span></code> arrays.</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 float32.</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</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 simple">
<li><strong>arg1</strong> (<em>tuple of int</em><em>, </em><em>tuple of array_like</em><em>, </em><em>array_like</em><em>, </em><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><em>CSRNDArray</em></a><em>, </em><em>scipy.sparse.csr_matrix</em><em>, </em><em>scipy.sparse.coo_matrix</em><em>, </em><em>tuple of int</em><em> or </em><em>tuple of array_like</em>) – The argument to help instantiate the csr matrix. See above for further details.</li>
<li><strong>shape</strong> (<em>tuple of int</em><em>, </em><em>optional</em>) – The shape of the csr matrix.</li>
<li><strong>ctx</strong> (<em>Context</em><em>, </em><em>optional</em>) – Device context (default is the current default context).</li>
<li><strong>dtype</strong> (<em>str</em><em> or </em><em>numpy.dtype</em><em>, </em><em>optional</em>) – The data type of the output array.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">A <cite>CSRNDArray</cite> with the <cite>csr</cite> storage representation.</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.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Example</p>
<div class="highlight-default"><div class="highlight"><pre><span></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">sparse</span><span class="o">.</span><span class="n">csr_matrix</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">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="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">2</span><span class="p">,</span> <span class="mi">3</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">3</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">a</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 0., 1., 0.],</span>
<span class="go"> [ 2., 0., 0.],</span>
<span class="go"> [ 0., 0., 0.],</span>
<span class="go"> [ 0., 0., 3.]], dtype=float32)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><code class="xref py py-func docutils literal"><span class="pre">CSRNDArray()</span></code></a></dt>
<dd>MXNet NDArray in compressed sparse row format.</dd>
</dl>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.row_sparse_array">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">row_sparse_array</code><span class="sig-paren">(</span><em>arg1</em>, <em>shape=None</em>, <em>ctx=None</em>, <em>dtype=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#row_sparse_array"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.row_sparse_array" title="Permalink to this definition"></a></dt>
<dd><p>Creates a <cite>RowSparseNDArray</cite>, a multidimensional row sparse array with a set of tensor slices at given indices.</p>
<p>The RowSparseNDArray can be instantiated in several ways:</p>
<ul class="simple">
<li><dl class="first docutils">
<dt>row_sparse_array(D):</dt>
<dd>to construct a RowSparseNDArray with a dense ndarray <code class="docutils literal"><span class="pre">D</span></code>
- <strong>D</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.
- <strong>ctx</strong> (<em>Context, optional</em>) - Device context (default is the current default context).
- <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">D.dtype</span></code> if <code class="docutils literal"><span class="pre">D</span></code> is an NDArray or numpy.ndarray, float32 otherwise.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>row_sparse_array(S)</dt>
<dd>to construct a RowSparseNDArray with a sparse ndarray <code class="docutils literal"><span class="pre">S</span></code>
- <strong>S</strong> (<em>RowSparseNDArray</em>) - A sparse ndarray.
- <strong>ctx</strong> (<em>Context, optional</em>) - Device context (default is the current default context).
- <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">S.dtype</span></code>.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>row_sparse_array((D0, D1 .. Dn))</dt>
<dd>to construct an empty RowSparseNDArray with shape <code class="docutils literal"><span class="pre">(D0,</span> <span class="pre">D1,</span> <span class="pre">...</span> <span class="pre">Dn)</span></code>
- <strong>D0, D1 .. Dn</strong> (<em>int</em>) - The shape of the ndarray
- <strong>ctx</strong> (<em>Context, optional</em>) - Device context (default is the current default context).
- <strong>dtype</strong> (<em>str or numpy.dtype, optional</em>) - The data type of the output array. The default dtype is float32.</dd>
</dl>
</li>
<li><dl class="first docutils">
<dt>row_sparse_array((data, indices))</dt>
<dd>to construct a RowSparseNDArray based on the definition of row sparse format using two separate arrays, where the <cite>indices</cite> stores the indices of the row slices with non-zeros,
while the values are stored in <cite>data</cite>. The corresponding NDArray <code class="docutils literal"><span class="pre">dense</span></code>
represented by RowSparseNDArray <code class="docutils literal"><span class="pre">rsp</span></code> has <code class="docutils literal"><span class="pre">dense[rsp.indices[i],</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">...]</span> <span class="pre">=</span> <span class="pre">rsp.data[i,</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">:,</span> <span class="pre">...]</span></code>
The row indices for are expected to be <strong>sorted in ascending order.</strong> - <strong>data</strong> (<em>array_like</em>) - An object exposing the array interface, which holds all the non-zero row slices of the array.
- <strong>indices</strong> (<em>array_like</em>) - An object exposing the array interface, which stores the row index for each row slice with non-zero elements.
- <strong>shape</strong> (<em>tuple of int, optional</em>) - The shape of the array. The default shape is inferred from the indices and indptr arrays.
- <strong>ctx</strong> (<em>Context, optional</em>) - Device context (default is the current default context).
- <strong>dtype</strong> (<em>str or numpy.dtype, optional</em>) - The data type of the output array. The default dtype is float32.</dd>
</dl>
</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 simple">
<li><strong>arg1</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>numpy.ndarray</em><em>, </em><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><em>RowSparseNDArray</em></a><em>, </em><em>tuple of int</em><em> or </em><em>tuple of array_like</em>) – The argument to help instantiate the row sparse ndarray. See above for further details.</li>
<li><strong>shape</strong> (<em>tuple of int</em><em>, </em><em>optional</em>) – The shape of the row sparse ndarray. (Default value = None)</li>
<li><strong>ctx</strong> (<em>Context</em><em>, </em><em>optional</em>) – Device context (default is the current default context).</li>
<li><strong>dtype</strong> (<em>str</em><em> or </em><em>numpy.dtype</em><em>, </em><em>optional</em>) – The data type of the output array. (Default value = None)</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">An <cite>RowSparseNDArray</cite> with the <cite>row_sparse</cite> storage representation.</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.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></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">sparse</span><span class="o">.</span><span class="n">row_sparse_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="p">[</span><span class="mi">1</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">6</span><span class="p">,</span> <span class="mi">2</span><span class="p">))</span>
<span class="gp">>>> </span><span class="n">a</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., 2.],</span>
<span class="go"> [ 0., 0.],</span>
<span class="go"> [ 0., 0.],</span>
<span class="go"> [ 3., 4.],</span>
<span class="go"> [ 0., 0.]], dtype=float32)</span>
</pre></div>
</div>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><code class="xref py py-func docutils literal"><span class="pre">RowSparseNDArray()</span></code></a></dt>
<dd>MXNet NDArray in row sparse format.</dd>
</dl>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.add">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">add</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.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> when shapes of lhs and rhs do not
match. If lhs.shape == rhs.shape, this is equivalent to
<code class="docutils literal"><span class="pre">mx.nd.elemwise_add(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.abs</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</em><em> or </em><em>mxnet.ndarray.sparse.array</em>) – First array to be added.</li>
<li><strong>rhs</strong> (<em>scalar</em><em> or </em><em>mxnet.ndarray.sparse.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></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">2</span><span class="p">,</span><span class="mi">3</span><span class="p">))</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'csr'</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">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="n">tostype</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">a</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">b</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">a</span><span class="o">+</span><span class="n">b</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">c</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="n">tostype</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">d</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="n">tostype</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">c</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">d</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">c</span><span class="o">+</span><span class="n">d</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.sparse.subtract">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">subtract</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#subtract"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.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> when shapes of lhs and rhs do not
match. If lhs.shape == rhs.shape, this is equivalent to
<code class="docutils literal"><span class="pre">mx.nd.elemwise_sub(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</em><em> or </em><em>mxnet.ndarray.sparse.array</em>) – First array to be subtracted.</li>
<li><strong>rhs</strong> (<em>scalar</em><em> or </em><em>mxnet.ndarray.sparse.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.__spec__</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></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">2</span><span class="p">,</span><span class="mi">3</span><span class="p">))</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'csr'</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">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="n">tostype</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">a</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">b</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">a</span><span class="o">-</span><span class="n">b</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">c</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="n">tostype</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">d</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="n">tostype</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">c</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">d</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">c</span><span class="o">-</span><span class="n">d</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>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.multiply">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">multiply</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#multiply"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.multiply" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise product of the input arrays with broadcasting.</p>
<blockquote>
<div>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>
when shapes of lhs and rhs do not match. If lhs.shape == rhs.shape,
this is equivalent to <code class="docutils literal"><span class="pre">mx.nd.elemwise_mul(lhs,</span> <span class="pre">rhs)</span></code></div></blockquote>
<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</em><em> or </em><em>mxnet.ndarray.sparse.array</em>) – First array to be multiplied.</li>
<li><strong>rhs</strong> (<em>scalar</em><em> or </em><em>mxnet.ndarray.sparse.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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="n">tostype</span><span class="p">(</span><span class="s1">'csr'</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">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([[ 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., 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([[ 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">sparse</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">x</span><span class="o">*</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., 2.],</span>
<span class="go"> [ 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">sparse</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">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., 2.],</span>
<span class="go"> [ 0., 1., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">z</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="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., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">*</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., 2.],</span>
<span class="go"> [ 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">sparse</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">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., 2.],</span>
<span class="go"> [ 0., 1., 2.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.ElementWiseSum">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">add_n</span></code> output depends on storage types of inputs</p>
<ul class="simple">
<li>add_n(row_sparse, row_sparse, ..) = row_sparse</li>
<li>add_n(default, csr, default) = default</li>
<li>add_n(any input combinations longer than 4 (>4) with at least one default type) = default</li>
<li>otherwise, <code class="docutils literal"><span class="pre">add_n</span></code> falls all inputs back to default storage and generates default storage</li>
</ul>
<p>Defined in src/operator/tensor/elemwise_sum.cc:L156</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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>[</em><em>]</em>) – Positional input arguments</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.Embedding">
<code class="descclassname">mxnet.ndarray.sparse.</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>sparse_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.sparse.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-default"><div class="highlight"><pre><span></span><span class="n">input_dim</span> <span class="o">=</span> <span class="mi">4</span>
<span class="n">output_dim</span> <span class="o">=</span> <span class="mi">5</span>
<span class="o">//</span> <span class="n">Each</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">weight</span> <span class="n">matrix</span> <span class="n">y</span> <span class="n">represents</span> <span class="n">a</span> <span class="n">word</span><span class="o">.</span> <span class="n">So</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="p">(</span><span class="n">w0</span><span class="p">,</span><span class="n">w1</span><span class="p">,</span><span class="n">w2</span><span class="p">,</span><span class="n">w3</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="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="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="mf">13.</span><span class="p">,</span> <span class="mf">14.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">15.</span><span class="p">,</span> <span class="mf">16.</span><span class="p">,</span> <span class="mf">17.</span><span class="p">,</span> <span class="mf">18.</span><span class="p">,</span> <span class="mf">19.</span><span class="p">]]</span>
<span class="o">//</span> <span class="n">Input</span> <span class="n">array</span> <span class="n">x</span> <span class="n">represents</span> <span class="n">n</span><span class="o">-</span><span class="n">grams</span><span class="p">(</span><span class="mi">2</span><span class="o">-</span><span class="n">gram</span><span class="p">)</span><span class="o">.</span> <span class="n">So</span><span class="p">,</span> <span class="n">x</span> <span class="o">=</span> <span class="p">[(</span><span class="n">w1</span><span class="p">,</span><span class="n">w3</span><span class="p">),</span> <span class="p">(</span><span class="n">w0</span><span class="p">,</span><span class="n">w2</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">3.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">2.</span><span class="p">]]</span>
<span class="o">//</span> <span class="n">Mapped</span> <span class="nb">input</span> <span class="n">x</span> <span class="n">to</span> <span class="n">its</span> <span class="n">vector</span> <span class="n">representation</span> <span class="n">y</span><span class="o">.</span>
<span class="n">Embedding</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">4</span><span class="p">,</span> <span class="mi">5</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">15.</span><span class="p">,</span> <span class="mf">16.</span><span class="p">,</span> <span class="mf">17.</span><span class="p">,</span> <span class="mf">18.</span><span class="p">,</span> <span class="mf">19.</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="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="mf">13.</span><span class="p">,</span> <span class="mf">14.</span><span class="p">]]]</span>
</pre></div>
</div>
<p>The storage type of weight can be either row_sparse or default.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If “sparse_grad” is set to True, the storage type of gradient w.r.t weights will be
“row_sparse”. Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
<a class="reference external" href="/api/python/optimization/optimization.html">/api/python/optimization/optimization.html</a></p>
</div>
<p>Defined in src/operator/tensor/indexing_op.cc:L519</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="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The embedding weight matrix.</li>
<li><strong>input_dim</strong> (<em>int</em><em>, </em><em>required</em>) – Vocabulary size of the input indices.</li>
<li><strong>output_dim</strong> (<em>int</em><em>, </em><em>required</em>) – Dimension of the embedding vectors.</li>
<li><strong>dtype</strong> (<em>{'float16'</em><em>, </em><em>'float32'</em><em>, </em><em>'float64'</em><em>, </em><em>'int32'</em><em>, </em><em>'int64'</em><em>, </em><em>'int8'</em><em>, </em><em>'uint8'}</em><em>,</em><em>optional</em><em>, </em><em>default='float32'</em>) – Data type of weight.</li>
<li><strong>sparse_grad</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – Compute row sparse gradient in the backward calculation. If set to True, the grad’s storage type is row_sparse.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.FullyConnected">
<code class="descclassname">mxnet.ndarray.sparse.</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>flatten=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.FullyConnected" title="Permalink to this definition"></a></dt>
<dd><p>Applies a linear transformation: <span class="math">\(Y = XW^T + b\)</span>.</p>
<p>If <code class="docutils literal"><span class="pre">flatten</span></code> is set to be true, then the shapes are:</p>
<ul class="simple">
<li><strong>data</strong>: <cite>(batch_size, x1, x2, ..., xn)</cite></li>
<li><strong>weight</strong>: <cite>(num_hidden, x1 * x2 * ... * xn)</cite></li>
<li><strong>bias</strong>: <cite>(num_hidden,)</cite></li>
<li><strong>out</strong>: <cite>(batch_size, num_hidden)</cite></li>
</ul>
<p>If <code class="docutils literal"><span class="pre">flatten</span></code> is set to be false, then the shapes are:</p>
<ul class="simple">
<li><strong>data</strong>: <cite>(x1, x2, ..., xn, 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>(x1, x2, ..., xn, 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>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>The sparse support for FullyConnected is limited to forward evaluation with <cite>row_sparse</cite>
weight and bias, where the length of <cite>weight.indices</cite> and <cite>bias.indices</cite> must be equal
to <cite>num_hidden</cite>. This could be useful for model inference with <cite>row_sparse</cite> weights
trained with importance sampling or noise contrastive estimation.</p>
<p class="last">To compute linear transformation with ‘csr’ sparse data, sparse.dot is recommended instead
of sparse.FullyConnected.</p>
</div>
<p>Defined in src/operator/nn/fully_connected.cc:L271</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data.</li>
<li><strong>weight</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight matrix.</li>
<li><strong>bias</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Bias parameter.</li>
<li><strong>num_hidden</strong> (<em>int</em><em>, </em><em>required</em>) – Number of hidden nodes of the output.</li>
<li><strong>no_bias</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – Whether to disable bias parameter.</li>
<li><strong>flatten</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Whether to collapse all but the first axis of the input data tensor.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.LinearRegressionOutput">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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}(\textbf{Y}, \hat{\textbf{Y}} ) = \frac{1}{n} \sum_{i=0}^{n-1} \lVert \textbf{y}_i - \hat{\textbf{y}}_i \rVert_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>The storage type of <code class="docutils literal"><span class="pre">label</span></code> can be <code class="docutils literal"><span class="pre">default</span></code> or <code class="docutils literal"><span class="pre">csr</span></code></p>
<ul class="simple">
<li>LinearRegressionOutput(default, default) = default</li>
<li>LinearRegressionOutput(default, csr) = default</li>
</ul>
<p>By default, gradients of this loss function are scaled by factor <cite>1/m</cite>, where m is the number of regression outputs of a training example.
The parameter <cite>grad_scale</cite> can be used to change this scale to <cite>grad_scale/m</cite>.</p>
<p>Defined in src/operator/regression_output.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="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input label to the function.</li>
<li><strong>grad_scale</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Scale the gradient by a float factor</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.LogisticRegressionOutput">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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(-\textbf{x})}\)</span>.</p>
<p>Commonly, the sigmoid is used to squash the real-valued output of a linear model
<span class="math">\(wTx+b\)</span> 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>The storage type of <code class="docutils literal"><span class="pre">label</span></code> can be <code class="docutils literal"><span class="pre">default</span></code> or <code class="docutils literal"><span class="pre">csr</span></code></p>
<ul class="simple">
<li>LogisticRegressionOutput(default, default) = default</li>
<li>LogisticRegressionOutput(default, csr) = default</li>
</ul>
<p>The loss function used is the Binary Cross Entropy Loss:</p>
<p><span class="math">\(-{(y\log(p) + (1 - y)\log(1 - p))}\)</span></p>
<p>Where <cite>y</cite> is the ground truth probability of positive outcome for a given example, and <cite>p</cite> the probability predicted by the model. By default, gradients of this loss function are scaled by factor <cite>1/m</cite>, where m is the number of regression outputs of a training example.
The parameter <cite>grad_scale</cite> can be used to change this scale to <cite>grad_scale/m</cite>.</p>
<p>Defined in src/operator/regression_output.cc:L152</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="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input label to the function.</li>
<li><strong>grad_scale</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Scale the gradient by a float factor</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.MAERegressionOutput">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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}(\textbf{Y}, \hat{\textbf{Y}} ) = \frac{1}{n} \sum_{i=0}^{n-1} \lVert \textbf{y}_i - \hat{\textbf{y}}_i \rVert_1\)</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>The storage type of <code class="docutils literal"><span class="pre">label</span></code> can be <code class="docutils literal"><span class="pre">default</span></code> or <code class="docutils literal"><span class="pre">csr</span></code></p>
<ul class="simple">
<li>MAERegressionOutput(default, default) = default</li>
<li>MAERegressionOutput(default, csr) = default</li>
</ul>
<p>By default, gradients of this loss function are scaled by factor <cite>1/m</cite>, where m is the number of regression outputs of a training example.
The parameter <cite>grad_scale</cite> can be used to change this scale to <cite>grad_scale/m</cite>.</p>
<p>Defined in src/operator/regression_output.cc:L120</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="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input label to the function.</li>
<li><strong>grad_scale</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Scale the gradient by a float factor</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.abs">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">abs</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>abs(default) = default</li>
<li>abs(row_sparse) = row_sparse</li>
<li>abs(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L662</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.adagrad_update">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">adagrad_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>history=None</em>, <em>lr=_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.sparse.adagrad_update" title="Permalink to this definition"></a></dt>
<dd><p>Update function for AdaGrad optimizer.</p>
<p>Referenced from <em>Adaptive Subgradient Methods for Online Learning and Stochastic Optimization</em>,
and available at <a class="reference external" href="http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf">http://www.jmlr.org/papers/volume12/duchi11a/duchi11a.pdf</a>.</p>
<p>Updates are applied by:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">rescaled_grad</span> <span class="o">=</span> <span class="n">clip</span><span class="p">(</span><span class="n">grad</span> <span class="o">*</span> <span class="n">rescale_grad</span><span class="p">,</span> <span class="n">clip_gradient</span><span class="p">)</span>
<span class="n">history</span> <span class="o">=</span> <span class="n">history</span> <span class="o">+</span> <span class="n">square</span><span class="p">(</span><span class="n">rescaled_grad</span><span class="p">)</span>
<span class="n">w</span> <span class="o">=</span> <span class="n">w</span> <span class="o">-</span> <span class="n">learning_rate</span> <span class="o">*</span> <span class="n">rescaled_grad</span> <span class="o">/</span> <span class="n">sqrt</span><span class="p">(</span><span class="n">history</span> <span class="o">+</span> <span class="n">epsilon</span><span class="p">)</span>
</pre></div>
</div>
<p>Note that non-zero values for the weight decay option are not supported.</p>
<p>Defined in src/operator/optimizer_op.cc:L665</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>history</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – History</li>
<li><strong>lr</strong> (<em>float</em><em>, </em><em>required</em>) – Learning rate</li>
<li><strong>epsilon</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=1e-07</em>) – epsilon</li>
<li><strong>wd</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – weight decay</li>
<li><strong>rescale_grad</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.adam_update">
<code class="descclassname">mxnet.ndarray.sparse.</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>lazy_update=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.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-default"><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>However, if grad’s storage type is <code class="docutils literal"><span class="pre">row_sparse</span></code>, <code class="docutils literal"><span class="pre">lazy_update</span></code> is True and the storage
type of weight is the same as those of m and v,
only the row slices whose indices appear in grad.indices are updated (for w, m and v):</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">grad</span><span class="o">.</span><span class="n">indices</span><span class="p">:</span>
<span class="n">m</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">=</span> <span class="n">beta1</span><span class="o">*</span><span class="n">m</span><span class="p">[</span><span class="n">row</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">beta1</span><span class="p">)</span><span class="o">*</span><span class="n">grad</span><span class="p">[</span><span class="n">row</span><span class="p">]</span>
<span class="n">v</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">=</span> <span class="n">beta2</span><span class="o">*</span><span class="n">v</span><span class="p">[</span><span class="n">row</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">beta2</span><span class="p">)</span><span class="o">*</span><span class="p">(</span><span class="n">grad</span><span class="p">[</span><span class="n">row</span><span class="p">]</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span>
<span class="n">w</span><span class="p">[</span><span class="n">row</span><span class="p">]</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="p">[</span><span class="n">row</span><span class="p">]</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="n">row</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:L495</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>mean</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Moving mean</li>
<li><strong>var</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Moving variance</li>
<li><strong>lr</strong> (<em>float</em><em>, </em><em>required</em>) – Learning rate</li>
<li><strong>beta1</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=0.9</em>) – The decay rate for the 1st moment estimates.</li>
<li><strong>beta2</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=0.999</em>) – The decay rate for the 2nd moment estimates.</li>
<li><strong>epsilon</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=1e-08</em>) – A small constant for numerical stability.</li>
<li><strong>wd</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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>lazy_update</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – If true, lazy updates are applied if gradient’s stype is row_sparse and all of w, m and v have the same stype</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.add_n">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">add_n</span></code> output depends on storage types of inputs</p>
<ul class="simple">
<li>add_n(row_sparse, row_sparse, ..) = row_sparse</li>
<li>add_n(default, csr, default) = default</li>
<li>add_n(any input combinations longer than 4 (>4) with at least one default type) = default</li>
<li>otherwise, <code class="docutils literal"><span class="pre">add_n</span></code> falls all inputs back to default storage and generates default storage</li>
</ul>
<p>Defined in src/operator/tensor/elemwise_sum.cc:L156</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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>[</em><em>]</em>) – Positional input arguments</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.arccos">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">arccos</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.arccosh">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">arccosh</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.arcsin">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">arcsin</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>arcsin(default) = default</li>
<li>arcsin(row_sparse) = row_sparse</li>
<li>arcsin(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.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>data</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.arcsinh">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">arcsinh</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>arcsinh(default) = default</li>
<li>arcsinh(row_sparse) = row_sparse</li>
<li>arcsinh(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L250</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.arctan">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">arctan</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>arctan(default) = default</li>
<li>arctan(row_sparse) = row_sparse</li>
<li>arctan(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L144</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.arctanh">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">arctanh</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>arctanh(default) = default</li>
<li>arctanh(row_sparse) = row_sparse</li>
<li>arctanh(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L281</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.broadcast_add">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>Supported sparse operations:</p>
<blockquote>
<div>broadcast_add(csr, dense(1D)) = dense
broadcast_add(dense(1D), csr) = dense</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.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>lhs</strong> (<a class="reference internal" href="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.broadcast_div">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>Supported sparse operations:</p>
<blockquote>
<div>broadcast_div(csr, dense(1D)) = csr</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L187</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="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.broadcast_minus">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>Supported sparse operations:</p>
<blockquote>
<div>broadcast_sub/minus(csr, dense(1D)) = dense
broadcast_sub/minus(dense(1D), csr) = dense</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.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>lhs</strong> (<a class="reference internal" href="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.broadcast_mul">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>Supported sparse operations:</p>
<blockquote>
<div>broadcast_mul(csr, dense(1D)) = csr</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.cc:L146</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="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.broadcast_plus">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>Supported sparse operations:</p>
<blockquote>
<div>broadcast_add(csr, dense(1D)) = dense
broadcast_add(dense(1D), csr) = dense</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.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>lhs</strong> (<a class="reference internal" href="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.broadcast_sub">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>Supported sparse operations:</p>
<blockquote>
<div>broadcast_sub/minus(csr, dense(1D)) = dense
broadcast_sub/minus(dense(1D), csr) = dense</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_binary_broadcast_op_basic.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>lhs</strong> (<a class="reference internal" href="ndarray.html#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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Second input to the function</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.cast_storage">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">cast_storage</code><span class="sig-paren">(</span><em>data=None</em>, <em>stype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.cast_storage" title="Permalink to this definition"></a></dt>
<dd><p>Casts tensor storage type to the new type.</p>
<p>When an NDArray with default storage type is cast to csr or row_sparse storage,
the result is compact, which means:</p>
<ul class="simple">
<li>for csr, zero values will not be retained</li>
<li>for row_sparse, row slices of all zeros will not be retained</li>
</ul>
<p>The storage type of <code class="docutils literal"><span class="pre">cast_storage</span></code> output depends on stype parameter:</p>
<ul class="simple">
<li>cast_storage(csr, ‘default’) = default</li>
<li>cast_storage(row_sparse, ‘default’) = default</li>
<li>cast_storage(default, ‘csr’) = csr</li>
<li>cast_storage(default, ‘row_sparse’) = row_sparse</li>
<li>cast_storage(csr, ‘csr’) = csr</li>
<li>cast_storage(row_sparse, ‘row_sparse’) = row_sparse</li>
</ul>
<p>Example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">dense</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">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">3.</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="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="c1"># cast to row_sparse storage type</span>
<span class="n">rsp</span> <span class="o">=</span> <span class="n">cast_storage</span><span class="p">(</span><span class="n">dense</span><span class="p">,</span> <span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="n">rsp</span><span class="o">.</span><span class="n">indices</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">rsp</span><span class="o">.</span><span class="n">values</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">0.</span><span class="p">],</span>
<span class="p">[</span> <span class="mf">2.</span><span class="p">,</span> <span class="mf">0.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">]]</span>
<span class="c1"># cast to csr storage type</span>
<span class="n">csr</span> <span class="o">=</span> <span class="n">cast_storage</span><span class="p">(</span><span class="n">dense</span><span class="p">,</span> <span class="s1">'csr'</span><span class="p">)</span>
<span class="n">csr</span><span class="o">.</span><span class="n">indices</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="n">csr</span><span class="o">.</span><span class="n">values</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="n">csr</span><span class="o">.</span><span class="n">indptr</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">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/cast_storage.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input.</li>
<li><strong>stype</strong> (<em>{'csr'</em><em>, </em><em>'default'</em><em>, </em><em>'row_sparse'}</em><em>, </em><em>required</em>) – Output storage type.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.cbrt">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">cbrt</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.sparse.cbrt" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise cube-root value of the input.</p>
<div class="math">
\[cbrt(x) = \sqrt[3]{x}\]</div>
<p>Example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">cbrt</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="mi">125</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="o">-</span><span class="mi">5</span><span class="p">]</span>
</pre></div>
</div>
<p>The storage type of <code class="docutils literal"><span class="pre">cbrt</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>cbrt(default) = default</li>
<li>cbrt(row_sparse) = row_sparse</li>
<li>cbrt(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L883</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.ceil">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">ceil</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>ceil(default) = default</li>
<li>ceil(row_sparse) = row_sparse</li>
<li>ceil(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L740</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.clip">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><div class="highlight"><pre><span></span><span class="n">clip</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">a_min</span><span class="p">,</span> <span class="n">a_max</span><span class="p">)</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="nb">min</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">a_max</span><span class="p">),</span> <span class="n">a_min</span><span class="p">))</span>
</pre></div>
</div>
<p>Example:</p>
<div class="highlight-default"><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>The storage type of <code class="docutils literal"><span class="pre">clip</span></code> output depends on storage types of inputs and the a_min, a_max parameter values:</p>
<blockquote>
<div><ul class="simple">
<li>clip(default) = default</li>
<li>clip(row_sparse, a_min <= 0, a_max >= 0) = row_sparse</li>
<li>clip(csr, a_min <= 0, a_max >= 0) = csr</li>
<li>clip(row_sparse, a_min < 0, a_max < 0) = default</li>
<li>clip(row_sparse, a_min > 0, a_max > 0) = default</li>
<li>clip(csr, a_min < 0, a_max < 0) = csr</li>
<li>clip(csr, a_min > 0, a_max > 0) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/matrix_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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input array.</li>
<li><strong>a_min</strong> (<em>float</em><em>, </em><em>required</em>) – Minimum value</li>
<li><strong>a_max</strong> (<em>float</em><em>, </em><em>required</em>) – Maximum value</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.concat">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">concat</span></code> output depends on storage types of inputs</p>
<ul class="simple">
<li>concat(csr, csr, ..., csr, dim=0) = csr</li>
<li>otherwise, <code class="docutils literal"><span class="pre">concat</span></code> generates output with default storage</li>
</ul>
<p>Example:</p>
<div class="highlight-default"><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">1</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="p">[[</span><span class="mi">3</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">4</span><span class="p">],[</span><span class="mi">5</span><span class="p">,</span><span class="mi">5</span><span class="p">]]</span>
<span class="n">z</span> <span class="o">=</span> <span class="p">[[</span><span class="mi">6</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">7</span><span class="p">],[</span><span class="mi">8</span><span class="p">,</span><span class="mi">8</span><span class="p">]]</span>
<span class="n">concat</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">z</span><span class="p">,</span><span class="n">dim</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">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="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">4.</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">5.</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="p">[</span> <span class="mf">7.</span><span class="p">,</span> <span class="mf">7.</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="n">Note</span> <span class="n">that</span> <span class="n">you</span> <span class="n">cannot</span> <span class="n">concat</span> <span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">,</span><span class="n">z</span> <span class="n">along</span> <span class="n">dimension</span> <span class="mi">1</span> <span class="n">since</span> <span class="n">dimension</span>
<span class="mi">0</span> <span class="ow">is</span> <span class="ow">not</span> <span class="n">the</span> <span class="n">same</span> <span class="k">for</span> <span class="nb">all</span> <span class="n">the</span> <span class="nb">input</span> <span class="n">arrays</span><span class="o">.</span>
<span class="n">concat</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="n">dim</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">3.</span><span class="p">,</span> <span class="mf">3.</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">4.</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="mf">7.</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">8.</span><span class="p">,</span> <span class="mf">8.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/nn/concat.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>data</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>[</em><em>]</em>) – List of arrays to concatenate</li>
<li><strong>dim</strong> (<em>int</em><em>, </em><em>optional</em><em>, </em><em>default='1'</em>) – the dimension to be concated.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.cos">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">cos</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.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>data</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.cosh">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">cosh</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L216</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.degrees">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">degrees</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>degrees(default) = default</li>
<li>degrees(row_sparse) = row_sparse</li>
<li>degrees(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L163</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.dot">
<code class="descclassname">mxnet.ndarray.sparse.</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>forward_stype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.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-default"><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-default"><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>The storage type of <code class="docutils literal"><span class="pre">dot</span></code> output depends on storage types of inputs, transpose option and
forward_stype option for output storage type. Implemented sparse operations include:</p>
<ul class="simple">
<li>dot(default, default, transpose_a=True/False, transpose_b=True/False) = default</li>
<li>dot(csr, default, transpose_a=True) = default</li>
<li>dot(csr, default, transpose_a=True) = row_sparse</li>
<li>dot(csr, default) = default</li>
<li>dot(csr, row_sparse) = default</li>
<li>dot(default, csr) = csr (CPU only)</li>
<li>dot(default, csr, forward_stype=’default’) = default</li>
<li>dot(default, csr, transpose_b=True, forward_stype=’default’) = default</li>
</ul>
<p>If the combination of input storage types and forward_stype does not match any of the
above patterns, <code class="docutils literal"><span class="pre">dot</span></code> will fallback and generate output with default storage.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">If the storage type of the lhs is “csr”, the storage type of gradient w.r.t rhs will be
“row_sparse”. Only a subset of optimizers support sparse gradients, including SGD, AdaGrad
and Adam. Note that by default lazy updates is turned on, which may perform differently
from standard updates. For more details, please check the Optimization API at:
<a class="reference external" href="/api/python/optimization/optimization.html">/api/python/optimization/optimization.html</a></p>
</div>
<p>Defined in src/operator/tensor/dot.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>lhs</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The second input</li>
<li><strong>transpose_a</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – If true then transpose the first input before dot.</li>
<li><strong>transpose_b</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – If true then transpose the second input before dot.</li>
<li><strong>forward_stype</strong> (<em>{None</em><em>, </em><em>'csr'</em><em>, </em><em>'default'</em><em>, </em><em>'row_sparse'}</em><em>,</em><em>optional</em><em>, </em><em>default='None'</em>) – The desired storage type of the forward output given by user, if thecombination of input storage types and this hint does not matchany implemented ones, the dot operator will perform fallback operationand still produce an output of the desired storage type.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.elemwise_add">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.elemwise_add" title="Permalink to this definition"></a></dt>
<dd><p>Adds arguments element-wise.</p>
<p>The storage type of <code class="docutils literal"><span class="pre">elemwise_add</span></code> output depends on storage types of inputs</p>
<blockquote>
<div><ul class="simple">
<li>elemwise_add(row_sparse, row_sparse) = row_sparse</li>
<li>elemwise_add(csr, csr) = csr</li>
<li>elemwise_add(default, csr) = default</li>
<li>elemwise_add(csr, default) = default</li>
<li>elemwise_add(default, rsp) = default</li>
<li>elemwise_add(rsp, default) = default</li>
<li>otherwise, <code class="docutils literal"><span class="pre">elemwise_add</span></code> generates output with default storage</li>
</ul>
</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – second input</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.elemwise_div">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">elemwise_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.sparse.elemwise_div" title="Permalink to this definition"></a></dt>
<dd><p>Divides arguments element-wise.</p>
<p>The storage type of <code class="docutils literal"><span class="pre">elemwise_div</span></code> output is always dense</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – second input</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.elemwise_mul">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">elemwise_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.sparse.elemwise_mul" title="Permalink to this definition"></a></dt>
<dd><p>Multiplies arguments element-wise.</p>
<p>The storage type of <code class="docutils literal"><span class="pre">elemwise_mul</span></code> output depends on storage types of inputs</p>
<blockquote>
<div><ul class="simple">
<li>elemwise_mul(default, default) = default</li>
<li>elemwise_mul(row_sparse, row_sparse) = row_sparse</li>
<li>elemwise_mul(default, row_sparse) = row_sparse</li>
<li>elemwise_mul(row_sparse, default) = row_sparse</li>
<li>elemwise_mul(csr, csr) = csr</li>
<li>otherwise, <code class="docutils literal"><span class="pre">elemwise_mul</span></code> generates output with default storage</li>
</ul>
</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – second input</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.elemwise_sub">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">elemwise_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.sparse.elemwise_sub" title="Permalink to this definition"></a></dt>
<dd><p>Subtracts arguments element-wise.</p>
<p>The storage type of <code class="docutils literal"><span class="pre">elemwise_sub</span></code> output depends on storage types of inputs</p>
<blockquote>
<div><ul class="simple">
<li>elemwise_sub(row_sparse, row_sparse) = row_sparse</li>
<li>elemwise_sub(csr, csr) = csr</li>
<li>elemwise_sub(default, csr) = default</li>
<li>elemwise_sub(csr, default) = default</li>
<li>elemwise_sub(default, rsp) = default</li>
<li>elemwise_sub(rsp, default) = default</li>
<li>otherwise, <code class="docutils literal"><span class="pre">elemwise_sub</span></code> generates output with default storage</li>
</ul>
</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – first input</li>
<li><strong>rhs</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – second input</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.exp">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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="mf">1.</span><span class="p">,</span> <span class="mf">2.71828175</span><span class="p">,</span> <span class="mf">7.38905621</span><span class="p">]</span>
</pre></div>
</div>
<p>The storage type of <code class="docutils literal"><span class="pre">exp</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L939</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.expm1">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">expm1</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>expm1(default) = default</li>
<li>expm1(row_sparse) = row_sparse</li>
<li>expm1(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L1018</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.fix">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">fix</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>fix(default) = default</li>
<li>fix(row_sparse) = row_sparse</li>
<li>fix(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L797</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.floor">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">floor</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>floor(default) = default</li>
<li>floor(row_sparse) = row_sparse</li>
<li>floor(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L759</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.ftrl_update">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">ftrl_update</code><span class="sig-paren">(</span><em>weight=None</em>, <em>grad=None</em>, <em>z=None</em>, <em>n=None</em>, <em>lr=_Null</em>, <em>lamda1=_Null</em>, <em>beta=_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.sparse.ftrl_update" title="Permalink to this definition"></a></dt>
<dd><p>Update function for Ftrl optimizer.
Referenced from <em>Ad Click Prediction: a View from the Trenches</em>, available at
<a class="reference external" href="http://dl.acm.org/citation.cfm?id=2488200">http://dl.acm.org/citation.cfm?id=2488200</a>.</p>
<p>It updates the weights using:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">rescaled_grad</span> <span class="o">=</span> <span class="n">clip</span><span class="p">(</span><span class="n">grad</span> <span class="o">*</span> <span class="n">rescale_grad</span><span class="p">,</span> <span class="n">clip_gradient</span><span class="p">)</span>
<span class="n">z</span> <span class="o">+=</span> <span class="n">rescaled_grad</span> <span class="o">-</span> <span class="p">(</span><span class="n">sqrt</span><span class="p">(</span><span class="n">n</span> <span class="o">+</span> <span class="n">rescaled_grad</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span> <span class="o">-</span> <span class="n">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">))</span> <span class="o">*</span> <span class="n">weight</span> <span class="o">/</span> <span class="n">learning_rate</span>
<span class="n">n</span> <span class="o">+=</span> <span class="n">rescaled_grad</span><span class="o">**</span><span class="mi">2</span>
<span class="n">w</span> <span class="o">=</span> <span class="p">(</span><span class="n">sign</span><span class="p">(</span><span class="n">z</span><span class="p">)</span> <span class="o">*</span> <span class="n">lamda1</span> <span class="o">-</span> <span class="n">z</span><span class="p">)</span> <span class="o">/</span> <span class="p">((</span><span class="n">beta</span> <span class="o">+</span> <span class="n">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">))</span> <span class="o">/</span> <span class="n">learning_rate</span> <span class="o">+</span> <span class="n">wd</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">z</span><span class="p">)</span> <span class="o">></span> <span class="n">lamda1</span><span class="p">)</span>
</pre></div>
</div>
<p>If w, z and n are all of <code class="docutils literal"><span class="pre">row_sparse</span></code> storage type,
only the row slices whose indices appear in grad.indices are updated (for w, z and n):</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">grad</span><span class="o">.</span><span class="n">indices</span><span class="p">:</span>
<span class="n">rescaled_grad</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">=</span> <span class="n">clip</span><span class="p">(</span><span class="n">grad</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">*</span> <span class="n">rescale_grad</span><span class="p">,</span> <span class="n">clip_gradient</span><span class="p">)</span>
<span class="n">z</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">+=</span> <span class="n">rescaled_grad</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">-</span> <span class="p">(</span><span class="n">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">+</span> <span class="n">rescaled_grad</span><span class="p">[</span><span class="n">row</span><span class="p">]</span><span class="o">**</span><span class="mi">2</span><span class="p">)</span> <span class="o">-</span> <span class="n">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="n">row</span><span class="p">]))</span> <span class="o">*</span> <span class="n">weight</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">/</span> <span class="n">learning_rate</span>
<span class="n">n</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">+=</span> <span class="n">rescaled_grad</span><span class="p">[</span><span class="n">row</span><span class="p">]</span><span class="o">**</span><span class="mi">2</span>
<span class="n">w</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="n">sign</span><span class="p">(</span><span class="n">z</span><span class="p">[</span><span class="n">row</span><span class="p">])</span> <span class="o">*</span> <span class="n">lamda1</span> <span class="o">-</span> <span class="n">z</span><span class="p">[</span><span class="n">row</span><span class="p">])</span> <span class="o">/</span> <span class="p">((</span><span class="n">beta</span> <span class="o">+</span> <span class="n">sqrt</span><span class="p">(</span><span class="n">n</span><span class="p">[</span><span class="n">row</span><span class="p">]))</span> <span class="o">/</span> <span class="n">learning_rate</span> <span class="o">+</span> <span class="n">wd</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">z</span><span class="p">[</span><span class="n">row</span><span class="p">])</span> <span class="o">></span> <span class="n">lamda1</span><span class="p">)</span>
</pre></div>
</div>
<p>Defined in src/operator/optimizer_op.cc:L632</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>z</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – z</li>
<li><strong>n</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Square of grad</li>
<li><strong>lr</strong> (<em>float</em><em>, </em><em>required</em>) – Learning rate</li>
<li><strong>lamda1</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=0.01</em>) – The L1 regularization coefficient.</li>
<li><strong>beta</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Per-Coordinate Learning Rate beta.</li>
<li><strong>wd</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.gamma">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">gamma</span></code> output is always dense</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.gammaln">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">gammaln</span></code> output is always dense</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.log">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">log</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L951</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.log10">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">log10</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L963</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.log1p">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">log1p</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>log1p(default) = default</li>
<li>log1p(row_sparse) = row_sparse</li>
<li>log1p(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L1000</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.log2">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">log2</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L975</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.make_loss">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.make_loss" 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-default"><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">make_loss</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">make_loss</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>The storage type of <code class="docutils literal"><span class="pre">make_loss</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>make_loss(default) = default</li>
<li>make_loss(row_sparse) = row_sparse</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L300</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.mean">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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:L132</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape</em><em> or </em><em>None</em><em>, </em><em>optional</em><em>, </em><em>default=None</em>) – <p>The axis or axes along which to perform the reduction.</p>
<blockquote>
<div>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.<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>
<p>Negative values means indexing from right to left.</p>
</div></blockquote>
</li>
<li><strong>keepdims</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=0</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</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.negative">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.negative" title="Permalink to this definition"></a></dt>
<dd><p>Numerical negative of the argument, element-wise.</p>
<p>The storage type of <code class="docutils literal"><span class="pre">negative</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>negative(default) = default</li>
<li>negative(row_sparse) = row_sparse</li>
<li>negative(csr) = csr</li>
</ul>
</div></blockquote>
<table class="docutils field-list" frame="void" rules="none">
<col class="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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.norm">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">norm</code><span class="sig-paren">(</span><em>data=None</em>, <em>ord=_Null</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.sparse.norm" title="Permalink to this definition"></a></dt>
<dd><p>Computes the norm on an NDArray.</p>
<p>This operator computes the norm on an NDArray with the specified axis, depending
on the value of the ord parameter. By default, it computes the L2 norm on the entire
array. Currently only ord=2 supports sparse ndarrays.</p>
<p>Examples:</p>
<div class="highlight-default"><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="p">[[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</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="n">norm</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="nb">ord</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">3.1622777</span> <span class="mf">4.472136</span> <span class="p">]</span>
<span class="p">[</span><span class="mf">5.3851647</span> <span class="mf">6.3245554</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="nb">ord</span><span class="o">=</span><span class="mi">1</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">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">rsp</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">cast_storage</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">)</span>
<span class="n">norm</span><span class="p">(</span><span class="n">rsp</span><span class="p">)</span> <span class="o">=</span> <span class="p">[</span><span class="mf">5.47722578</span><span class="p">]</span>
<span class="n">csr</span> <span class="o">=</span> <span class="n">x</span><span class="o">.</span><span class="n">cast_storage</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">)</span>
<span class="n">norm</span><span class="p">(</span><span class="n">csr</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:L350</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>ord</strong> (<em>int</em><em>, </em><em>optional</em><em>, </em><em>default='2'</em>) – Order of the norm. Currently ord=1 and ord=2 is supported.</li>
<li><strong>axis</strong> (<em>Shape</em><em> or </em><em>None</em><em>, </em><em>optional</em><em>, </em><em>default=None</em>) – <dl class="docutils">
<dt>The axis or axes along which to perform the reduction.</dt>
<dd>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.
If <cite>axis</cite> is int, a reduction is performed on a particular axis.
If <cite>axis</cite> is a 2-tuple, it specifies the axes that hold 2-D matrices,
and the matrix norms of these matrices are computed.</dd>
</dl>
</li>
<li><strong>keepdims</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=0</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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.radians">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">radians</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>radians(default) = default</li>
<li>radians(row_sparse) = row_sparse</li>
<li>radians(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L182</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.relu">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.relu" title="Permalink to this definition"></a></dt>
<dd><p>Computes rectified linear.</p>
<div class="math">
\[max(features, 0)\]</div>
<p>The storage type of <code class="docutils literal"><span class="pre">relu</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>relu(default) = default</li>
<li>relu(row_sparse) = row_sparse</li>
<li>relu(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.retain">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">retain</code><span class="sig-paren">(</span><em>data=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.sparse.retain" title="Permalink to this definition"></a></dt>
<dd><p>pick rows specified by user input index array from a row sparse matrix
and save them in the output sparse matrix.</p>
<p>Example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">data</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="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]]</span>
<span class="n">indices</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">3</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">2</span><span class="p">)</span>
<span class="n">rsp_in</span> <span class="o">=</span> <span class="n">row_sparse</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">indices</span><span class="p">)</span>
<span class="n">to_retain</span> <span class="o">=</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="n">rsp_out</span> <span class="o">=</span> <span class="n">retain</span><span class="p">(</span><span class="n">rsp_in</span><span class="p">,</span> <span class="n">to_retain</span><span class="p">)</span>
<span class="n">rsp_out</span><span class="o">.</span><span class="n">values</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">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">]]</span>
<span class="n">rsp_out</span><span class="o">.</span><span class="n">indices</span> <span class="o">=</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>The storage type of <code class="docutils literal"><span class="pre">retain</span></code> output depends on storage types of inputs</p>
<ul class="simple">
<li>retain(row_sparse, default) = row_sparse</li>
<li>otherwise, <code class="docutils literal"><span class="pre">retain</span></code> is not supported</li>
</ul>
<p>Defined in src/operator/tensor/sparse_retain.cc:L53</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array for sparse_retain operator.</li>
<li><strong>indices</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The index array of rows ids that will be retained.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.rint">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">rint</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>rint(default) = default</li>
<li>rint(row_sparse) = row_sparse</li>
<li>rint(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L721</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.round">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">round</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>round(default) = default</li>
<li>round(row_sparse) = row_sparse</li>
<li>round(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L700</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.rsqrt">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">rsqrt</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L860</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sgd_mom_update">
<code class="descclassname">mxnet.ndarray.sparse.</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>lazy_update=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.sgd_mom_update" title="Permalink to this definition"></a></dt>
<dd><p>Momentum update function for Stochastic Gradient Descent (SGD) 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-default"><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>However, if grad’s storage type is <code class="docutils literal"><span class="pre">row_sparse</span></code>, <code class="docutils literal"><span class="pre">lazy_update</span></code> is True and weight’s storage
type is the same as momentum’s storage type,
only the row slices whose indices appear in grad.indices are updated (for both weight and momentum):</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">gradient</span><span class="o">.</span><span class="n">indices</span><span class="p">:</span>
<span class="n">v</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">=</span> <span class="n">momentum</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">*</span> <span class="n">v</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">-</span> <span class="n">learning_rate</span> <span class="o">*</span> <span class="n">gradient</span><span class="p">[</span><span class="n">row</span><span class="p">]</span>
<span class="n">weight</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">+=</span> <span class="n">v</span><span class="p">[</span><span class="n">row</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/optimizer_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>weight</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>mom</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Momentum</li>
<li><strong>lr</strong> (<em>float</em><em>, </em><em>required</em>) – Learning rate</li>
<li><strong>momentum</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – The decay rate of momentum estimates at each epoch.</li>
<li><strong>wd</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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>lazy_update</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – If true, lazy updates are applied if gradient’s stype is row_sparse and both weight and momentum have the same stype</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sgd_update">
<code class="descclassname">mxnet.ndarray.sparse.</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>lazy_update=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.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-default"><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="p">(</span><span class="n">gradient</span> <span class="o">+</span> <span class="n">wd</span> <span class="o">*</span> <span class="n">weight</span><span class="p">)</span>
</pre></div>
</div>
<p>However, if gradient is of <code class="docutils literal"><span class="pre">row_sparse</span></code> storage type and <code class="docutils literal"><span class="pre">lazy_update</span></code> is True,
only the row slices whose indices appear in grad.indices are updated:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="k">for</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">gradient</span><span class="o">.</span><span class="n">indices</span><span class="p">:</span>
<span class="n">weight</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">=</span> <span class="n">weight</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">-</span> <span class="n">learning_rate</span> <span class="o">*</span> <span class="p">(</span><span class="n">gradient</span><span class="p">[</span><span class="n">row</span><span class="p">]</span> <span class="o">+</span> <span class="n">wd</span> <span class="o">*</span> <span class="n">weight</span><span class="p">[</span><span class="n">row</span><span class="p">])</span>
</pre></div>
</div>
<p>Defined in src/operator/optimizer_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>weight</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Weight</li>
<li><strong>grad</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Gradient</li>
<li><strong>lr</strong> (<em>float</em><em>, </em><em>required</em>) – Learning rate</li>
<li><strong>wd</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – Rescale gradient to grad = rescale_grad*grad.</li>
<li><strong>clip_gradient</strong> (<em>float</em><em>, </em><em>optional</em><em>, </em><em>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>lazy_update</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=1</em>) – If true, lazy updates are applied if gradient’s stype is row_sparse.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sigmoid">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">sigmoid</span></code> output is always dense</p>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L101</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sign">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.sign" title="Permalink to this definition"></a></dt>
<dd><p>Returns element-wise sign of the input.</p>
<p>Example:</p>
<div class="highlight-default"><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>The storage type of <code class="docutils literal"><span class="pre">sign</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>sign(default) = default</li>
<li>sign(row_sparse) = row_sparse</li>
<li>sign(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L681</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sin">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">sin</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>sin(default) = default</li>
<li>sin(row_sparse) = row_sparse</li>
<li>sin(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L46</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sinh">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">sinh</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>sinh(default) = default</li>
<li>sinh(row_sparse) = row_sparse</li>
<li>sinh(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L201</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.slice">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">slice</code><span class="sig-paren">(</span><em>data=None</em>, <em>begin=_Null</em>, <em>end=_Null</em>, <em>step=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.sparse.slice" title="Permalink to this definition"></a></dt>
<dd><p>Slices a 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 array between the indices given
by <cite>begin</cite> and <cite>end</cite> with the corresponding <cite>step</cite>.</p>
<p>For an input array of <code class="docutils literal"><span class="pre">shape=(d_0,</span> <span class="pre">d_1,</span> <span class="pre">...,</span> <span class="pre">d_n-1)</span></code>,
slice operation with <code class="docutils literal"><span class="pre">begin=(b_0,</span> <span class="pre">b_1...b_m-1)</span></code>,
<code class="docutils literal"><span class="pre">end=(e_0,</span> <span class="pre">e_1,</span> <span class="pre">...,</span> <span class="pre">e_m-1)</span></code>, and <code class="docutils literal"><span class="pre">step=(s_0,</span> <span class="pre">s_1,</span> <span class="pre">...,</span> <span class="pre">s_m-1)</span></code>,
where m <= n, results in an array with the shape
<code class="docutils literal"><span class="pre">(|e_0-b_0|/|s_0|,</span> <span class="pre">...,</span> <span class="pre">|e_m-1-b_m-1|/|s_m-1|,</span> <span class="pre">d_m,</span> <span class="pre">...,</span> <span class="pre">d_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 starting
from index <code class="docutils literal"><span class="pre">b_k</span></code> (inclusive) with step <code class="docutils literal"><span class="pre">s_k</span></code>
until reaching <code class="docutils literal"><span class="pre">e_k</span></code> (exclusive).</p>
<p>If the <em>k</em>-th elements are <cite>None</cite> in the sequence of <cite>begin</cite>, <cite>end</cite>,
and <cite>step</cite>, the following rule will be used to set default values.
If <cite>s_k</cite> is <cite>None</cite>, set <cite>s_k=1</cite>. If <cite>s_k > 0</cite>, set <cite>b_k=0</cite>, <cite>e_k=d_k</cite>;
else, set <cite>b_k=d_k-1</cite>, <cite>e_k=-1</cite>.</p>
<p>The storage type of <code class="docutils literal"><span class="pre">slice</span></code> output depends on storage types of inputs</p>
<ul class="simple">
<li>slice(csr) = csr</li>
<li>otherwise, <code class="docutils literal"><span class="pre">slice</span></code> generates output with default storage</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">When input data storage type is csr, it only supports
step=(), or step=(None,), or step=(1,) to generate a csr output.
For other step parameter values, it falls back to slicing
a dense tensor.</p>
</div>
<p>Example:</p>
<div class="highlight-default"><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>
<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="kc">None</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">end</span><span class="o">=</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="mi">3</span><span class="p">),</span> <span class="n">step</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">2</span><span class="p">))</span> <span class="o">=</span> <span class="p">[[</span><span class="mf">9.</span><span class="p">,</span> <span class="mf">11.</span><span class="p">],</span>
<span class="p">[</span><span class="mf">5.</span><span class="p">,</span> <span class="mf">7.</span><span class="p">],</span>
<span class="p">[</span><span class="mf">1.</span><span class="p">,</span> <span class="mf">3.</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/matrix_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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Source input</li>
<li><strong>begin</strong> (<em>Shape</em><em>(</em><em>tuple</em><em>)</em><em>, </em><em>required</em>) – starting indices for the slice operation, supports negative indices.</li>
<li><strong>end</strong> (<em>Shape</em><em>(</em><em>tuple</em><em>)</em><em>, </em><em>required</em>) – ending indices for the slice operation, supports negative indices.</li>
<li><strong>step</strong> (<em>Shape</em><em>(</em><em>tuple</em><em>)</em><em>, </em><em>optional</em><em>, </em><em>default=</em><em>[</em><em>]</em>) – step for the slice operation, supports negative values.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sqrt">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">sqrt</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>sqrt(default) = default</li>
<li>sqrt(row_sparse) = row_sparse</li>
<li>sqrt(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L840</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.square">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">square</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>square(default) = default</li>
<li>square(row_sparse) = row_sparse</li>
<li>square(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L817</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.stop_gradient">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><div class="highlight"><pre><span></span><span class="n">v1</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="n">v2</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">a</span> <span class="o">=</span> <span class="n">Variable</span><span class="p">(</span><span class="s1">'a'</span><span class="p">)</span>
<span class="n">b</span> <span class="o">=</span> <span class="n">Variable</span><span class="p">(</span><span class="s1">'b'</span><span class="p">)</span>
<span class="n">b_stop_grad</span> <span class="o">=</span> <span class="n">stop_gradient</span><span class="p">(</span><span class="mi">3</span> <span class="o">*</span> <span class="n">b</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">b_stop_grad</span> <span class="o">+</span> <span class="n">a</span><span class="p">)</span>
<span class="n">executor</span> <span class="o">=</span> <span class="n">loss</span><span class="o">.</span><span class="n">simple_bind</span><span class="p">(</span><span class="n">ctx</span><span class="o">=</span><span class="n">cpu</span><span class="p">(),</span> <span class="n">a</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="n">b</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="n">executor</span><span class="o">.</span><span class="n">forward</span><span class="p">(</span><span class="n">is_train</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="n">v1</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="n">v2</span><span class="p">)</span>
<span class="n">executor</span><span class="o">.</span><span class="n">outputs</span>
<span class="p">[</span> <span class="mf">1.</span> <span class="mf">5.</span><span class="p">]</span>
<span class="n">executor</span><span class="o">.</span><span class="n">backward</span><span class="p">()</span>
<span class="n">executor</span><span class="o">.</span><span class="n">grad_arrays</span>
<span class="p">[</span> <span class="mf">0.</span> <span class="mf">0.</span><span class="p">]</span>
<span class="p">[</span> <span class="mf">1.</span> <span class="mf">1.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L267</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.sum">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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.
For ndarray of csr storage type summation along axis 0 and axis 1 is supported.
Setting keepdims or exclude to True will cause a fallback to dense operator.</p>
</div>
<p>Example:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">data</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">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">],</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="p">[[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">4</span><span class="p">],</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="p">[</span><span class="mi">5</span><span class="p">,</span> <span class="mi">2</span><span class="p">]],</span>
<span class="p">[[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">7</span><span class="p">,</span> <span class="mi">3</span><span class="p">]]]</span>
<span class="nb">sum</span><span class="p">(</span><span class="n">data</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="p">[[</span> <span class="mf">4.</span> <span class="mf">8.</span><span class="p">]</span>
<span class="p">[</span> <span class="mf">10.</span> <span class="mf">9.</span><span class="p">]</span>
<span class="p">[</span> <span class="mf">21.</span> <span class="mf">6.</span><span class="p">]]</span>
<span class="nb">sum</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">axis</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="mf">12.</span> <span class="mf">19.</span> <span class="mf">27.</span><span class="p">]</span>
<span class="n">data</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">0</span><span class="p">],</span>
<span class="p">[</span><span class="mi">3</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="p">[</span><span class="mi">4</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">csr</span> <span class="o">=</span> <span class="n">cast_storage</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="s1">'csr'</span><span class="p">)</span>
<span class="nb">sum</span><span class="p">(</span><span class="n">csr</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="p">[</span> <span class="mf">8.</span> <span class="mf">3.</span> <span class="mf">1.</span><span class="p">]</span>
<span class="nb">sum</span><span class="p">(</span><span class="n">csr</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="p">[</span> <span class="mf">3.</span> <span class="mf">4.</span> <span class="mf">5.</span><span class="p">]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/broadcast_reduce_op_value.cc:L116</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>axis</strong> (<em>Shape</em><em> or </em><em>None</em><em>, </em><em>optional</em><em>, </em><em>default=None</em>) – <p>The axis or axes along which to perform the reduction.</p>
<blockquote>
<div>The default, <cite>axis=()</cite>, will compute over all elements into a
scalar array with shape <cite>(1,)</cite>.<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>
<p>Negative values means indexing from right to left.</p>
</div></blockquote>
</li>
<li><strong>keepdims</strong> (<em>boolean</em><em>, </em><em>optional</em><em>, </em><em>default=0</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</em><em>, </em><em>optional</em><em>, </em><em>default=0</em>) – Whether to perform reduction on axis that are NOT in axis instead.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.tan">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">tan</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>tan(default) = default</li>
<li>tan(row_sparse) = row_sparse</li>
<li>tan(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L83</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.tanh">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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>The storage type of <code class="docutils literal"><span class="pre">tanh</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>tanh(default) = default</li>
<li>tanh(row_sparse) = row_sparse</li>
<li>tanh(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_trig.cc:L234</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.trunc">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.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-default"><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>The storage type of <code class="docutils literal"><span class="pre">trunc</span></code> output depends upon the input storage type:</p>
<blockquote>
<div><ul class="simple">
<li>trunc(default) = default</li>
<li>trunc(row_sparse) = row_sparse</li>
<li>trunc(csr) = csr</li>
</ul>
</div></blockquote>
<p>Defined in src/operator/tensor/elemwise_unary_op_basic.cc:L779</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input array.</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.where">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.where" title="Permalink to this definition"></a></dt>
<dd><p>Return the elements, either from x or y, depending on the condition.</p>
<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.</p>
<p>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>Note that all non-zero values are interpreted as <code class="docutils literal"><span class="pre">True</span></code> in condition.</p>
<p>Examples:</p>
<div class="highlight-default"><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">y</span> <span class="o">=</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="n">cond</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="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="n">where</span><span class="p">(</span><span class="n">cond</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="mi">5</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">8</span><span class="p">]]</span>
<span class="n">csr_cond</span> <span class="o">=</span> <span class="n">cast_storage</span><span class="p">(</span><span class="n">cond</span><span class="p">,</span> <span class="s1">'csr'</span><span class="p">)</span>
<span class="n">where</span><span class="p">(</span><span class="n">csr_cond</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="mi">5</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">8</span><span class="p">]]</span>
</pre></div>
</div>
<p>Defined in src/operator/tensor/control_flow_op.cc:L57</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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – condition array</li>
<li><strong>x</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – </li>
<li><strong>y</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – </li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.zeros_like">
<code class="descclassname">mxnet.ndarray.sparse.</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.sparse.zeros_like" title="Permalink to this definition"></a></dt>
<dd><p>Return an array of zeros with the same shape, type and storage type
as the input array.</p>
<p>The storage type of <code class="docutils literal"><span class="pre">zeros_like</span></code> output depends on the storage type of the input</p>
<ul class="simple">
<li>zeros_like(row_sparse) = row_sparse</li>
<li>zeros_like(csr) = csr</li>
<li>zeros_like(default) = default</li>
</ul>
<p>Examples:</p>
<div class="highlight-default"><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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The input</li>
<li><strong>out</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><em>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"><a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a> or list of NDArrays</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="mxnet.ndarray.sparse.divide">
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">divide</code><span class="sig-paren">(</span><em>lhs</em>, <em>rhs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#divide"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.ndarray.sparse.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>
when shapes of lhs and rhs do not match. If lhs.shape == rhs.shape,
this is equivalent to <code class="docutils literal"><span class="pre">mx.nd.elemwise_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</em><em> or </em><em>mxnet.ndarray.sparse.array</em>) – First array in division.</li>
<li><strong>rhs</strong> (<em>scalar</em><em> or </em><em>mxnet.ndarray.sparse.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="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray">NDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">x</span> <span class="o">=</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">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="p">)</span><span class="o">.</span><span class="n">tostype</span><span class="p">(</span><span class="s1">'csr'</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="o">+</span> <span class="mi">1</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">3</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([[ 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([[ 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., 2., 3.], 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([[ 6., 6., 6.],</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">sparse</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([[ 6., 6., 6.],</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">z</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 6., 3., 2.],</span>
<span class="go"> [ 6., 3., 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">sprase</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">z</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 6., 3., 2.],</span>
<span class="go"> [ 6., 3., 2.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="n">z</span> <span class="o">=</span> <span class="n">z</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="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., 2., 3.]], dtype=float32)</span>
<span class="gp">>>> </span><span class="p">(</span><span class="n">x</span><span class="o">/</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([[ 6., 3., 2.],</span>
<span class="go"> [ 6., 3., 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">sparse</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">z</span><span class="p">)</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">()</span>
<span class="go">array([[ 6., 3., 2.],</span>
<span class="go"> [ 6., 3., 2.]], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<p>Sparse NDArray API of MXNet.</p>
<dl class="function">
<dt>
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">zeros</code><span class="sig-paren">(</span><em>stype</em>, <em>shape</em>, <em>ctx=None</em>, <em>dtype=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#zeros"><span class="viewcode-link">[source]</span></a></dt>
<dd><p>Return a new array of given shape and type, filled with zeros.</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>stype</strong> (<em>string</em>) – The storage type of the empty array, such as ‘row_sparse’, ‘csr’, etc</li>
<li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of int</em>) – The shape of the empty array</li>
<li><strong>ctx</strong> (<em>Context</em><em>, </em><em>optional</em>) – An optional device context (default is the current default context)</li>
<li><strong>dtype</strong> (<em>str</em><em> or </em><em>numpy.dtype</em><em>, </em><em>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.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'csr'</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="go"><CSRNDArray 1x2 @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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'row_sparse'</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="n">ctx</span><span class="o">=</span><span class="n">mx</span><span class="o">.</span><span class="n">cpu</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([[ 0., 0.]], dtype=float16)</span>
</pre></div>
</div>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">mxnet.ndarray.sparse.</code><code class="descname">empty</code><span class="sig-paren">(</span><em>stype</em>, <em>shape</em>, <em>ctx=None</em>, <em>dtype=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#empty"><span class="viewcode-link">[source]</span></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>stype</strong> (<em>string</em>) – The storage type of the empty array, such as ‘row_sparse’, ‘csr’, etc</li>
<li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of int</em>) – The shape of the empty array.</li>
<li><strong>ctx</strong> (<em>Context</em><em>, </em><em>optional</em>) – An optional device context (default is the current default context).</li>
<li><strong>dtype</strong> (<em>str</em><em> or </em><em>numpy.dtype</em><em>, </em><em>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.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt>
<code class="descclassname">mxnet.ndarray.sparse.</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="reference internal" href="../../../_modules/mxnet/ndarray/sparse.html#array"><span class="viewcode-link">[source]</span></a></dt>
<dd><p>Creates a sparse 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> (<a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><em>RowSparseNDArray</em></a><em>, </em><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><em>CSRNDArray</em></a><em> or </em><em>scipy.sparse.csr.csr_matrix</em>) – The source sparse array</li>
<li><strong>ctx</strong> (<em>Context</em><em>, </em><em>optional</em>) – The default context is <code class="docutils literal"><span class="pre">source_array.context</span></code> if <code class="docutils literal"><span class="pre">source_array</span></code> is an NDArray. The current default context otherwise.</li>
<li><strong>dtype</strong> (<em>str</em><em> or </em><em>numpy.dtype</em><em>, </em><em>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>numpy.ndarray</cite> or <cite>scipy.sparse.csr.csr_matrix</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 array 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.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a></p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">scipy.sparse</span> <span class="k">as</span> <span class="nn">spsp</span>
<span class="gp">>>> </span><span class="n">csr</span> <span class="o">=</span> <span class="n">spsp</span><span class="o">.</span><span class="n">csr_matrix</span><span class="p">((</span><span class="mi">2</span><span class="p">,</span> <span class="mi">100</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">sparse</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">csr</span><span class="p">)</span>
<span class="go"><CSRNDArray 2x100 @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">sparse</span><span class="o">.</span><span class="n">array</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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'csr'</span><span class="p">,</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"><CSRNDArray 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">sparse</span><span class="o">.</span><span class="n">array</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">sparse</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="s1">'row_sparse'</span><span class="p">,</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"><RowSparseNDArray 3x2 @cpu(0)></span>
</pre></div>
</div>
</dd></dl>
<span class="target" id="module-mxnet.ndarray"></span><p>NDArray API of MXNet.</p>
<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="reference internal" href="../../../_modules/mxnet/ndarray/utils.html#load"><span class="viewcode-link">[source]</span></a><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, <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a>, or dict of str to NDArray, <a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray">RowSparseNDArray</a> or <a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray">CSRNDArray</a></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="reference internal" href="../../../_modules/mxnet/ndarray/utils.html#save"><span class="viewcode-link">[source]</span></a><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> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em>, </em><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><em>RowSparseNDArray</em></a><em> or </em><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><em>CSRNDArray</em></a><em>, or </em><em>list of NDArray</em><em>, </em><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><em>RowSparseNDArray</em></a><em> or </em><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><em>CSRNDArray</em></a><em>, or </em><em>dict of str to NDArray</em><em>, </em><a class="reference internal" href="#mxnet.ndarray.sparse.RowSparseNDArray" title="mxnet.ndarray.sparse.RowSparseNDArray"><em>RowSparseNDArray</em></a><em> or </em><a class="reference internal" href="#mxnet.ndarray.sparse.CSRNDArray" title="mxnet.ndarray.sparse.CSRNDArray"><em>CSRNDArray</em></a>) – The data to save.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-default"><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>
<script>auto_index("api-reference");</script></div>
</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="#">Sparse NDArray API</a><ul>
<li><a class="reference internal" href="#overview">Overview</a></li>
<li><a class="reference internal" href="#the-csrndarray-class">The <code class="docutils literal"><span class="pre">CSRNDArray</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-inspection">Array inspection</a></li>
<li><a class="reference internal" href="#array-creation">Array creation</a></li>
<li><a class="reference internal" href="#array-reduction">Array reduction</a></li>
<li><a class="reference internal" href="#array-rounding">Array rounding</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="#exponents-and-logarithms">Exponents and logarithms</a></li>
<li><a class="reference internal" href="#powers">Powers</a></li>
<li><a class="reference internal" href="#joining-arrays">Joining arrays</a></li>
<li><a class="reference internal" href="#indexing">Indexing</a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</a></li>
<li><a class="reference internal" href="#lazy-evaluation">Lazy evaluation</a></li>
</ul>
</li>
<li><a class="reference internal" href="#the-rowsparsendarray-class">The <code class="docutils literal"><span class="pre">RowSparseNDArray</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-inspection">Array inspection</a></li>
<li><a class="reference internal" href="#array-creation">Array creation</a></li>
<li><a class="reference internal" href="#array-reduction">Array reduction</a></li>
<li><a class="reference internal" href="#array-rounding">Array rounding</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="#exponents-and-logarithms">Exponents and logarithms</a></li>
<li><a class="reference internal" href="#powers">Powers</a></li>
<li><a class="reference internal" href="#indexing">Indexing</a></li>
<li><a class="reference internal" href="#lazy-evaluation">Lazy evaluation</a></li>
<li><a class="reference internal" href="#miscellaneous">Miscellaneous</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-storage-type">Changing array storage type</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="#miscellaneous">Miscellaneous</a></li>
</ul>
</li>
<li><a class="reference internal" href="#neural-network">Neural network</a><ul>
<li><a class="reference internal" href="#updater">Updater</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><div class="footer">
<div class="section-disclaimer">
<div class="container">
<div>
<img height="60" src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/apache_incubator_logo.png"/>
<p>
Apache MXNet is an effort undergoing incubation at The Apache Software Foundation (ASF), <strong>sponsored by the <i>Apache Incubator</i></strong>. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.
</p>
<p>
"Copyright © 2017-2018, The Apache Software Foundation
Apache MXNet, MXNet, Apache, the Apache feather, and the Apache MXNet project logo are either registered trademarks or trademarks of the Apache Software Foundation."
</p>
</div>
</div>
</div>
</div> <!-- pagename != index -->
</div>
<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 src="../../../_static/js/page.js" type="text/javascript"></script>
<script src="../../../_static/js/docversion.js" type="text/javascript"></script>
<script type="text/javascript">
$('body').ready(function () {
$('body').css('visibility', 'visible');
});
</script>
</body>
</html>