| <!DOCTYPE html> |
| |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"/> |
| <meta content="IE=edge" http-equiv="X-UA-Compatible"/> |
| <meta content="width=device-width, initial-scale=1" name="viewport"/> |
| <title>Contrib NDArray API — mxnet documentation</title> |
| <link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" rel="stylesheet"/> |
| <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/> |
| <link href="../../../_static/basic.css" rel="stylesheet" type="text/css"> |
| <link href="../../../_static/pygments.css" rel="stylesheet" type="text/css"> |
| <link href="../../../_static/mxnet.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript"> |
| var DOCUMENTATION_OPTIONS = { |
| URL_ROOT: '../../../', |
| VERSION: '', |
| COLLAPSE_INDEX: false, |
| FILE_SUFFIX: '.html', |
| HAS_SOURCE: true, |
| SOURCELINK_SUFFIX: '' |
| }; |
| </script> |
| <script src="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("/searchindex.js"); Search.init();}); </script> |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new |
| Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-96378503-1', 'auto'); |
| ga('send', 'pageview'); |
| |
| </script> |
| <!-- --> |
| <!-- <script type="text/javascript" src="../../../_static/jquery.js"></script> --> |
| <!-- --> |
| <!-- <script type="text/javascript" src="../../../_static/underscore.js"></script> --> |
| <!-- --> |
| <!-- <script type="text/javascript" src="../../../_static/doctools.js"></script> --> |
| <!-- --> |
| <!-- <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> --> |
| <!-- --> |
| <link href="../index.html" rel="up" title="MXNet - Python API"> |
| <link href="../symbol/symbol.html" rel="next" title="Symbol API"/> |
| <link href="sparse.html" rel="prev" title="Sparse 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></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="../../../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="../../../gluon/index.html">About</a></li> |
| <li><a class="main-nav-link" href="http://gluon.mxnet.io">Tutorials</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="../../../api/python/index.html">Python</a></li> |
| <li><a class="main-nav-link" href="../../../api/scala/index.html">Scala</a></li> |
| <li><a class="main-nav-link" href="../../../api/r/index.html">R</a></li> |
| <li><a class="main-nav-link" href="../../../api/julia/index.html">Julia</a></li> |
| <li><a class="main-nav-link" href="../../../api/c++/index.html">C++</a></li> |
| <li><a class="main-nav-link" href="../../../api/perl/index.html">Perl</a></li> |
| </ul> |
| </span> |
| <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="../../../tutorials/index.html">Tutorials</a> |
| <li><a class="main-nav-link" href="../../../faq/index.html">FAQ</a></li> |
| <li><a class="main-nav-link" href="../../../architecture/index.html">Architecture</a></li> |
| <li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.1.0/example">Examples</a></li> |
| <li><a class="main-nav-link" href="../../../api/python/gluon/model_zoo.html">Gluon Model Zoo</a></li> |
| </li></ul> |
| </span> |
| <a class="main-nav-link" href="https://github.com/dmlc/mxnet">Github</a> |
| <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="../../../community/index.html">Community</a></li> |
| <li><a class="main-nav-link" href="../../../community/contribute.html">Contribute</a></li> |
| <li><a class="main-nav-link" href="../../../community/powered_by.html">Powered By</a></li> |
| <li><a class="main-nav-link" href="http://discuss.mxnet.io">Discuss</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">Versions(1.1.0)<span class="caret"></span></a><ul id="package-dropdown-menu" class="dropdown-menu"><li><a class="main-nav-link" href=https://mxnet.incubator.apache.org/>1.1.0</a></li><li><a class="main-nav-link" href=https://mxnet.incubator.apache.org/versions/1.0.0/index.html>1.0.0</a></li><li><a class="main-nav-link" href=https://mxnet.incubator.apache.org/versions/0.12.1/index.html>0.12.1</a></li><li><a class="main-nav-link" href=https://mxnet.incubator.apache.org/versions/0.12.0/index.html>0.12.0</a></li><li><a class="main-nav-link" href=https://mxnet.incubator.apache.org/versions/0.11.0/index.html>0.11.0</a></li><li><a class="main-nav-link" href=https://mxnet.incubator.apache.org/versions/master/index.html>master</a></li></ul></span></nav> |
| <script> function getRootPath(){ return "../../../" } </script> |
| <div class="burgerIcon dropdown"> |
| <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button">☰</a> |
| <ul class="dropdown-menu" id="burgerMenu"> |
| <li><a href="../../../install/index.html">Install</a></li> |
| <li><a class="main-nav-link" href="../../../tutorials/index.html">Tutorials</a></li> |
| <li class="dropdown-submenu"> |
| <a href="#" tabindex="-1">Community</a> |
| <ul class="dropdown-menu"> |
| <li><a href="../../../community/index.html" tabindex="-1">Community</a></li> |
| <li><a href="../../../community/contribute.html" tabindex="-1">Contribute</a></li> |
| <li><a href="../../../community/powered_by.html" tabindex="-1">Powered By</a></li> |
| </ul> |
| </li> |
| <li class="dropdown-submenu"> |
| <a href="#" tabindex="-1">API</a> |
| <ul class="dropdown-menu"> |
| <li><a href="../../../api/python/index.html" tabindex="-1">Python</a> |
| </li> |
| <li><a href="../../../api/scala/index.html" tabindex="-1">Scala</a> |
| </li> |
| <li><a href="../../../api/r/index.html" tabindex="-1">R</a> |
| </li> |
| <li><a href="../../../api/julia/index.html" tabindex="-1">Julia</a> |
| </li> |
| <li><a href="../../../api/c++/index.html" tabindex="-1">C++</a> |
| </li> |
| <li><a href="../../../api/perl/index.html" tabindex="-1">Perl</a> |
| </li> |
| </ul> |
| </li> |
| <li class="dropdown-submenu"> |
| <a href="#" tabindex="-1">Docs</a> |
| <ul class="dropdown-menu"> |
| <li><a href="../../../tutorials/index.html" tabindex="-1">Tutorials</a></li> |
| <li><a href="../../../faq/index.html" tabindex="-1">FAQ</a></li> |
| <li><a href="../../../architecture/index.html" tabindex="-1">Architecture</a></li> |
| <li><a href="https://github.com/apache/incubator-mxnet/tree/1.1.0/example" tabindex="-1">Examples</a></li> |
| <li><a href="../../../api/python/gluon/model_zoo.html" tabindex="-1">Gluon Model Zoo</a></li> |
| </ul> |
| </li> |
| <li><a href="../../../architecture/index.html">Architecture</a></li> |
| <li><a class="main-nav-link" href="https://github.com/dmlc/mxnet">Github</a></li> |
| <li id="dropdown-menu-position-anchor-version-mobile" class="dropdown-submenu" style="position: relative"><a href="#" tabindex="-1">Versions(1.1.0)</a><ul class="dropdown-menu"><li><a tabindex="-1" href=https://mxnet.incubator.apache.org/>1.1.0</a></li><li><a tabindex="-1" href=https://mxnet.incubator.apache.org/versions/1.0.0/index.html>1.0.0</a></li><li><a tabindex="-1" href=https://mxnet.incubator.apache.org/versions/0.12.1/index.html>0.12.1</a></li><li><a tabindex="-1" href=https://mxnet.incubator.apache.org/versions/0.12.0/index.html>0.12.0</a></li><li><a tabindex="-1" href=https://mxnet.incubator.apache.org/versions/0.11.0/index.html>0.11.0</a></li><li><a tabindex="-1" href=https://mxnet.incubator.apache.org/versions/master/index.html>master</a></li></ul></li></ul> |
| </div> |
| <div class="plusIcon dropdown"> |
| <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"><span aria-hidden="true" class="glyphicon glyphicon-plus"></span></a> |
| <ul class="dropdown-menu dropdown-menu-right" id="plusMenu"></ul> |
| </div> |
| <div id="search-input-wrap"> |
| <form action="../../../search.html" autocomplete="off" class="" method="get" role="search"> |
| <div class="form-group inner-addon left-addon"> |
| <i class="glyphicon glyphicon-search"></i> |
| <input class="form-control" name="q" placeholder="Search" type="text"/> |
| </div> |
| <input name="check_keywords" type="hidden" value="yes"> |
| <input name="area" type="hidden" value="default"/> |
| </input></form> |
| <div id="search-preview"></div> |
| </div> |
| <div id="searchIcon"> |
| <span aria-hidden="true" class="glyphicon glyphicon-search"></span> |
| </div> |
| <!-- <div id="lang-select-wrap"> --> |
| <!-- <label id="lang-select-label"> --> |
| <!-- <\!-- <i class="fa fa-globe"></i> -\-> --> |
| <!-- <span></span> --> |
| <!-- </label> --> |
| <!-- <select id="lang-select"> --> |
| <!-- <option value="en">Eng</option> --> |
| <!-- <option value="zh">中文</option> --> |
| <!-- </select> --> |
| <!-- </div> --> |
| <!-- <a id="mobile-nav-toggle"> |
| <span class="mobile-nav-toggle-bar"></span> |
| <span class="mobile-nav-toggle-bar"></span> |
| <span class="mobile-nav-toggle-bar"></span> |
| </a> --> |
| </div> |
| </div> |
| </div> |
| <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">Python Documents</a><ul class="current"> |
| <li class="toctree-l2 current"><a class="reference internal" href="../index.html#ndarray-api">NDArray API</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="ndarray.html">NDArray API</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="random.html">Random Distribution Generator NDArray API</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="linalg.html">Linear Algebra NDArray API</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="sparse.html">Sparse NDArray API</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="">Contrib NDArray API</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="#overview">Overview</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#contrib">Contrib</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#api-reference">API Reference</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#symbol-api">Symbol API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#module-api">Module API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#autograd-api">Autograd API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#gluon-api">Gluon API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#kvstore-api">KVStore API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#io-api">IO API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#image-api">Image API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#optimization-api">Optimization API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#callback-api">Callback API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#metric-api">Metric API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#run-time-compilation-api">Run-Time Compilation API</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#contrib-package">Contrib Package</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../../r/index.html">R Documents</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../julia/index.html">Julia Documents</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../c++/index.html">C++ Documents</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../scala/index.html">Scala Documents</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../perl/index.html">Perl Documents</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../faq/index.html">HowTo Documents</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../architecture/index.html">System Documents</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../tutorials/index.html">Tutorials</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../../../community/index.html">Community</a></li> |
| </ul> |
| </div> |
| </div> |
| <div class="content"> |
| <div class="page-tracker"></div> |
| <div class="section" id="contrib-ndarray-api"> |
| <span id="contrib-ndarray-api"></span><h1>Contrib NDArray API<a class="headerlink" href="#contrib-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 contrib routines of the <em>n</em>-dimensional array package:</p> |
| <table border="1" class="longtable docutils"> |
| <colgroup> |
| <col width="10%"/> |
| <col width="90%"/> |
| </colgroup> |
| <tbody valign="top"> |
| <tr class="row-odd"><td><a class="reference internal" href="#module-mxnet.ndarray.contrib" title="mxnet.ndarray.contrib"><code class="xref py py-obj docutils literal"><span class="pre">mxnet.ndarray.contrib</span></code></a></td> |
| <td>Contrib NDArray API of MXNet.</td> |
| </tr> |
| </tbody> |
| </table> |
| <p>The <code class="docutils literal"><span class="pre">Contrib</span> <span class="pre">NDArray</span></code> API, defined in the <code class="docutils literal"><span class="pre">ndarray.contrib</span></code> package, provides |
| many useful experimental APIs for new features. |
| This is a place for the community to try out the new features, |
| so that feature contributors can receive feedback.</p> |
| <div class="admonition warning"> |
| <p class="first admonition-title">Warning</p> |
| <p class="last">This package contains experimental APIs and may change in the near future.</p> |
| </div> |
| <p>In the rest of this document, we list routines provided by the <code class="docutils literal"><span class="pre">ndarray.contrib</span></code> package.</p> |
| </div> |
| <div class="section" id="contrib"> |
| <span id="contrib"></span><h2>Contrib<a class="headerlink" href="#contrib" title="Permalink to this headline">¶</a></h2> |
| <table border="1" class="longtable docutils"> |
| <colgroup> |
| <col width="10%"/> |
| <col width="90%"/> |
| </colgroup> |
| <tbody valign="top"> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.CTCLoss" title="mxnet.ndarray.contrib.CTCLoss"><code class="xref py py-obj docutils literal"><span class="pre">CTCLoss</span></code></a></td> |
| <td>Connectionist Temporal Classification Loss.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.contrib.DeformableConvolution" title="mxnet.ndarray.contrib.DeformableConvolution"><code class="xref py py-obj docutils literal"><span class="pre">DeformableConvolution</span></code></a></td> |
| <td>Compute 2-D deformable convolution on 4-D input.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.DeformablePSROIPooling" title="mxnet.ndarray.contrib.DeformablePSROIPooling"><code class="xref py py-obj docutils literal"><span class="pre">DeformablePSROIPooling</span></code></a></td> |
| <td>Performs deformable position-sensitive region-of-interest pooling on inputs.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.contrib.MultiBoxDetection" title="mxnet.ndarray.contrib.MultiBoxDetection"><code class="xref py py-obj docutils literal"><span class="pre">MultiBoxDetection</span></code></a></td> |
| <td>Convert multibox detection predictions.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.MultiBoxPrior" title="mxnet.ndarray.contrib.MultiBoxPrior"><code class="xref py py-obj docutils literal"><span class="pre">MultiBoxPrior</span></code></a></td> |
| <td>Generate prior(anchor) boxes from data, sizes and ratios.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.contrib.MultiBoxTarget" title="mxnet.ndarray.contrib.MultiBoxTarget"><code class="xref py py-obj docutils literal"><span class="pre">MultiBoxTarget</span></code></a></td> |
| <td>Compute Multibox training targets</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.MultiProposal" title="mxnet.ndarray.contrib.MultiProposal"><code class="xref py py-obj docutils literal"><span class="pre">MultiProposal</span></code></a></td> |
| <td>Generate region proposals via RPN</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.contrib.PSROIPooling" title="mxnet.ndarray.contrib.PSROIPooling"><code class="xref py py-obj docutils literal"><span class="pre">PSROIPooling</span></code></a></td> |
| <td>Performs region-of-interest pooling on inputs.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.Proposal" title="mxnet.ndarray.contrib.Proposal"><code class="xref py py-obj docutils literal"><span class="pre">Proposal</span></code></a></td> |
| <td>Generate region proposals via RPN</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.contrib.count_sketch" title="mxnet.ndarray.contrib.count_sketch"><code class="xref py py-obj docutils literal"><span class="pre">count_sketch</span></code></a></td> |
| <td>Apply CountSketch to input: map a d-dimension data to k-dimension data”</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.ctc_loss" title="mxnet.ndarray.contrib.ctc_loss"><code class="xref py py-obj docutils literal"><span class="pre">ctc_loss</span></code></a></td> |
| <td>Connectionist Temporal Classification Loss.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.contrib.dequantize" title="mxnet.ndarray.contrib.dequantize"><code class="xref py py-obj docutils literal"><span class="pre">dequantize</span></code></a></td> |
| <td>Dequantize the input tensor into a float tensor.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.fft" title="mxnet.ndarray.contrib.fft"><code class="xref py py-obj docutils literal"><span class="pre">fft</span></code></a></td> |
| <td>Apply 1D FFT to input”</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.ndarray.contrib.ifft" title="mxnet.ndarray.contrib.ifft"><code class="xref py py-obj docutils literal"><span class="pre">ifft</span></code></a></td> |
| <td>Apply 1D ifft to input”</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="#mxnet.ndarray.contrib.quantize" title="mxnet.ndarray.contrib.quantize"><code class="xref py py-obj docutils literal"><span class="pre">quantize</span></code></a></td> |
| <td>Quantize a input tensor from float to <cite>out_type</cite>, with user-specified <cite>min_range</cite> and <cite>max_range</cite>.</td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="section" id="api-reference"> |
| <span id="api-reference"></span><h2>API Reference<a class="headerlink" href="#api-reference" title="Permalink to this headline">¶</a></h2> |
| <script src="../../../_static/js/auto_module_index.js" type="text/javascript"></script><span class="target" id="module-mxnet.ndarray.contrib"></span><p>Contrib NDArray API of MXNet.</p> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.CTCLoss"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">CTCLoss</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>data_lengths=None</em>, <em>label_lengths=None</em>, <em>use_data_lengths=_Null</em>, <em>use_label_lengths=_Null</em>, <em>blank_label=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.CTCLoss" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Connectionist Temporal Classification Loss.</p> |
| <p>The shapes of the inputs and outputs:</p> |
| <ul class="simple"> |
| <li><strong>data</strong>: <cite>(sequence_length, batch_size, alphabet_size)</cite></li> |
| <li><strong>label</strong>: <cite>(batch_size, label_sequence_length)</cite></li> |
| <li><strong>out</strong>: <cite>(batch_size)</cite></li> |
| </ul> |
| <p>The <cite>data</cite> tensor consists of sequences of activation vectors (without applying softmax), |
| with i-th channel in the last dimension corresponding to i-th label |
| for i between 0 and alphabet_size-1 (i.e always 0-indexed). |
| Alphabet size should include one additional value reserved for blank label. |
| When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, the <code class="docutils literal"><span class="pre">0</span></code>-th channel is be reserved for |
| activation of blank label, or otherwise if it is “last”, <code class="docutils literal"><span class="pre">(alphabet_size-1)</span></code>-th channel should be |
| reserved for blank label.</p> |
| <p><code class="docutils literal"><span class="pre">label</span></code> is an index matrix of integers. When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, |
| the value 0 is then reserved for blank label, and should not be passed in this matrix. Otherwise, |
| when <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"last"</span></code>, the value <cite>(alphabet_size-1)</cite> is reserved for blank label.</p> |
| <p>If a sequence of labels is shorter than <em>label_sequence_length</em>, use the special |
| padding value at the end of the sequence to conform it to the correct |
| length. The padding value is <cite>0</cite> when <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, and <cite>-1</cite> otherwise.</p> |
| <p>For example, suppose the vocabulary is <cite>[a, b, c]</cite>, and in one batch we have three sequences |
| ‘ba’, ‘cbb’, and ‘abac’. When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, we can index the labels as |
| <cite>{‘a’: 1, ‘b’: 2, ‘c’: 3}</cite>, and we reserve the 0-th channel for blank label in data tensor. |
| The resulting <cite>label</cite> tensor should be padded to be:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></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="mi">0</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="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">]]</span> |
| </pre></div> |
| </div> |
| <p>When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"last"</span></code>, we can index the labels as |
| <cite>{‘a’: 0, ‘b’: 1, ‘c’: 2}</cite>, and we reserve the channel index 3 for blank label in data tensor. |
| The resulting <cite>label</cite> tensor should be padded to be:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></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="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</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">1</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">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">]]</span> |
| </pre></div> |
| </div> |
| <p><code class="docutils literal"><span class="pre">out</span></code> is a list of CTC loss values, one per example in the batch.</p> |
| <p>See <em>Connectionist Temporal Classification: Labelling Unsegmented |
| Sequence Data with Recurrent Neural Networks</em>, A. Graves <em>et al</em>. for more |
| information on the definition and the algorithm.</p> |
| <p>Defined in src/operator/contrib/ctc_loss.cc:L115</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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 ctc_loss op.</li> |
| <li><strong>label</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Ground-truth labels for the loss.</li> |
| <li><strong>data_lengths</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Lengths of data for each of the samples. Only required when use_data_lengths is true.</li> |
| <li><strong>label_lengths</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Lengths of labels for each of the samples. Only required when use_label_lengths is true.</li> |
| <li><strong>use_data_lengths</strong> (<em>boolean, optional, default=0</em>) – Whether the data lenghts are decided by <cite>data_lengths</cite>. If false, the lengths are equal to the max sequence length.</li> |
| <li><strong>use_label_lengths</strong> (<em>boolean, optional, default=0</em>) – Whether the label lenghts are decided by <cite>label_lengths</cite>, or derived from <cite>padding_mask</cite>. If false, the lengths are derived from the first occurrence of the value of <cite>padding_mask</cite>. The value of <cite>padding_mask</cite> is <code class="docutils literal"><span class="pre">0</span></code> when first CTC label is reserved for blank, and <code class="docutils literal"><span class="pre">-1</span></code> when last label is reserved for blank. See <cite>blank_label</cite>.</li> |
| <li><strong>blank_label</strong> (<em>{'first', 'last'},optional, default='first'</em>) – Set the label that is reserved for blank label.If “first”, 0-th label is reserved, and label values for tokens in the vocabulary are between <code class="docutils literal"><span class="pre">1</span></code> and <code class="docutils literal"><span class="pre">alphabet_size-1</span></code>, and the padding mask is <code class="docutils literal"><span class="pre">-1</span></code>. If “last”, last label value <code class="docutils literal"><span class="pre">alphabet_size-1</span></code> is reserved for blank label instead, and label values for tokens in the vocabulary are between <code class="docutils literal"><span class="pre">0</span></code> and <code class="docutils literal"><span class="pre">alphabet_size-2</span></code>, and the padding mask is <code class="docutils literal"><span class="pre">0</span></code>.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.DeformableConvolution"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">DeformableConvolution</code><span class="sig-paren">(</span><em>data=None</em>, <em>offset=None</em>, <em>weight=None</em>, <em>bias=None</em>, <em>kernel=_Null</em>, <em>stride=_Null</em>, <em>dilate=_Null</em>, <em>pad=_Null</em>, <em>num_filter=_Null</em>, <em>num_group=_Null</em>, <em>num_deformable_group=_Null</em>, <em>workspace=_Null</em>, <em>no_bias=_Null</em>, <em>layout=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.DeformableConvolution" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Compute 2-D deformable convolution on 4-D input.</p> |
| <p>The deformable convolution operation is described in <a class="reference external" href="https://arxiv.org/abs/1703.06211">https://arxiv.org/abs/1703.06211</a></p> |
| <p>For 2-D deformable convolution, the shapes are</p> |
| <ul class="simple"> |
| <li><strong>data</strong>: <em>(batch_size, channel, height, width)</em></li> |
| <li><strong>offset</strong>: <em>(batch_size, num_deformable_group * kernel[0] * kernel[1], height, width)</em></li> |
| <li><strong>weight</strong>: <em>(num_filter, channel, kernel[0], kernel[1])</em></li> |
| <li><strong>bias</strong>: <em>(num_filter,)</em></li> |
| <li><strong>out</strong>: <em>(batch_size, num_filter, out_height, out_width)</em>.</li> |
| </ul> |
| <p>Define:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">f</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="n">k</span><span class="p">,</span><span class="n">p</span><span class="p">,</span><span class="n">s</span><span class="p">,</span><span class="n">d</span><span class="p">)</span> <span class="o">=</span> <span class="n">floor</span><span class="p">((</span><span class="n">x</span><span class="o">+</span><span class="mi">2</span><span class="o">*</span><span class="n">p</span><span class="o">-</span><span class="n">d</span><span class="o">*</span><span class="p">(</span><span class="n">k</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="n">s</span><span class="p">)</span><span class="o">+</span><span class="mi">1</span> |
| </pre></div> |
| </div> |
| <p>then we have:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">out_height</span><span class="o">=</span><span class="n">f</span><span class="p">(</span><span class="n">height</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">dilate</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> |
| <span class="n">out_width</span><span class="o">=</span><span class="n">f</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">kernel</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">pad</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">stride</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">dilate</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span> |
| </pre></div> |
| </div> |
| <p>If <code class="docutils literal"><span class="pre">no_bias</span></code> is set to be true, then the <code class="docutils literal"><span class="pre">bias</span></code> term is ignored.</p> |
| <p>The default data <code class="docutils literal"><span class="pre">layout</span></code> is <em>NCHW</em>, namely <em>(batch_size, channle, height, |
| width)</em>.</p> |
| <p>If <code class="docutils literal"><span class="pre">num_group</span></code> is larger than 1, denoted by <em>g</em>, then split the input <code class="docutils literal"><span class="pre">data</span></code> |
| evenly into <em>g</em> parts along the channel axis, and also evenly split <code class="docutils literal"><span class="pre">weight</span></code> |
| along the first dimension. Next compute the convolution on the <em>i</em>-th part of |
| the data with the <em>i</em>-th weight part. The output is obtained by concating all |
| the <em>g</em> results.</p> |
| <p>If <code class="docutils literal"><span class="pre">num_deformable_group</span></code> is larger than 1, denoted by <em>dg</em>, then split the |
| input <code class="docutils literal"><span class="pre">offset</span></code> evenly into <em>dg</em> parts along the channel axis, and also evenly |
| split <code class="docutils literal"><span class="pre">out</span></code> evenly into <em>dg</em> parts along the channel axis. Next compute the |
| deformable convolution, apply the <em>i</em>-th part of the offset part on the <em>i</em>-th |
| out.</p> |
| <p>Both <code class="docutils literal"><span class="pre">weight</span></code> and <code class="docutils literal"><span class="pre">bias</span></code> are learnable parameters.</p> |
| <p>Defined in src/operator/contrib/deformable_convolution.cc:L100</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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 DeformableConvolutionOp.</li> |
| <li><strong>offset</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input offset to the DeformableConvolutionOp.</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>kernel</strong> (<em>Shape(tuple), required</em>) – Convolution kernel size: (h, w) or (d, h, w)</li> |
| <li><strong>stride</strong> (<em>Shape(tuple), optional, default=[]</em>) – Convolution stride: (h, w) or (d, h, w). Defaults to 1 for each dimension.</li> |
| <li><strong>dilate</strong> (<em>Shape(tuple), optional, default=[]</em>) – Convolution dilate: (h, w) or (d, h, w). Defaults to 1 for each dimension.</li> |
| <li><strong>pad</strong> (<em>Shape(tuple), optional, default=[]</em>) – Zero pad for convolution: (h, w) or (d, h, w). Defaults to no padding.</li> |
| <li><strong>num_filter</strong> (<em>int (non-negative), required</em>) – Convolution filter(channel) number</li> |
| <li><strong>num_group</strong> (<em>int (non-negative), optional, default=1</em>) – Number of group partitions.</li> |
| <li><strong>num_deformable_group</strong> (<em>int (non-negative), optional, default=1</em>) – Number of deformable group partitions.</li> |
| <li><strong>workspace</strong> (<em>long (non-negative), optional, default=1024</em>) – Maximum temperal workspace allowed for convolution (MB).</li> |
| <li><strong>no_bias</strong> (<em>boolean, optional, default=0</em>) – Whether to disable bias parameter.</li> |
| <li><strong>layout</strong> (<em>{None, 'NCDHW', 'NCHW', 'NCW'},optional, default='None'</em>) – Set layout for input, output and weight. Empty for |
| default layout: NCW for 1d, NCHW for 2d and NCDHW for 3d.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.DeformablePSROIPooling"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">DeformablePSROIPooling</code><span class="sig-paren">(</span><em>data=None</em>, <em>rois=None</em>, <em>trans=None</em>, <em>spatial_scale=_Null</em>, <em>output_dim=_Null</em>, <em>group_size=_Null</em>, <em>pooled_size=_Null</em>, <em>part_size=_Null</em>, <em>sample_per_part=_Null</em>, <em>trans_std=_Null</em>, <em>no_trans=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.DeformablePSROIPooling" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Performs deformable position-sensitive region-of-interest pooling on inputs. |
| The DeformablePSROIPooling operation is described in <a class="reference external" href="https://arxiv.org/abs/1703.06211">https://arxiv.org/abs/1703.06211</a> .batch_size will change to the number of region bounding boxes after DeformablePSROIPooling</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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="../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Input data to the pooling operator, a 4D Feature maps</li> |
| <li><strong>rois</strong> (<a class="reference internal" href="../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Bounding box coordinates, a 2D array of [[batch_index, x1, y1, x2, y2]]. (x1, y1) and (x2, y2) are top left and down right corners of designated region of interest. batch_index indicates the index of corresponding image in the input data</li> |
| <li><strong>trans</strong> (<a class="reference internal" href="../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – transition parameter</li> |
| <li><strong>spatial_scale</strong> (<em>float, required</em>) – Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layers</li> |
| <li><strong>output_dim</strong> (<em>int, required</em>) – fix output dim</li> |
| <li><strong>group_size</strong> (<em>int, required</em>) – fix group size</li> |
| <li><strong>pooled_size</strong> (<em>int, required</em>) – fix pooled size</li> |
| <li><strong>part_size</strong> (<em>int, optional, default='0'</em>) – fix part size</li> |
| <li><strong>sample_per_part</strong> (<em>int, optional, default='1'</em>) – fix samples per part</li> |
| <li><strong>trans_std</strong> (<em>float, optional, default=0</em>) – fix transition std</li> |
| <li><strong>no_trans</strong> (<em>boolean, optional, default=0</em>) – Whether to disable trans parameter.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.MultiBoxDetection"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">MultiBoxDetection</code><span class="sig-paren">(</span><em>cls_prob=None</em>, <em>loc_pred=None</em>, <em>anchor=None</em>, <em>clip=_Null</em>, <em>threshold=_Null</em>, <em>background_id=_Null</em>, <em>nms_threshold=_Null</em>, <em>force_suppress=_Null</em>, <em>variances=_Null</em>, <em>nms_topk=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.MultiBoxDetection" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Convert multibox detection predictions.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
| <li><strong>cls_prob</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Class probabilities.</li> |
| <li><strong>loc_pred</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Location regression predictions.</li> |
| <li><strong>anchor</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Multibox prior anchor boxes</li> |
| <li><strong>clip</strong> (<em>boolean, optional, default=1</em>) – Clip out-of-boundary boxes.</li> |
| <li><strong>threshold</strong> (<em>float, optional, default=0.01</em>) – Threshold to be a positive prediction.</li> |
| <li><strong>background_id</strong> (<em>int, optional, default='0'</em>) – Background id.</li> |
| <li><strong>nms_threshold</strong> (<em>float, optional, default=0.5</em>) – Non-maximum suppression threshold.</li> |
| <li><strong>force_suppress</strong> (<em>boolean, optional, default=0</em>) – Suppress all detections regardless of class_id.</li> |
| <li><strong>variances</strong> (<em>tuple of <float>, optional, default=[0.1,0.1,0.2,0.2]</em>) – Variances to be decoded from box regression output.</li> |
| <li><strong>nms_topk</strong> (<em>int, optional, default='-1'</em>) – Keep maximum top k detections before nms, -1 for no limit.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.MultiBoxPrior"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">MultiBoxPrior</code><span class="sig-paren">(</span><em>data=None</em>, <em>sizes=_Null</em>, <em>ratios=_Null</em>, <em>clip=_Null</em>, <em>steps=_Null</em>, <em>offsets=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.MultiBoxPrior" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Generate prior(anchor) boxes from data, sizes and ratios.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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>sizes</strong> (<em>tuple of <float>, optional, default=[1]</em>) – List of sizes of generated MultiBoxPriores.</li> |
| <li><strong>ratios</strong> (<em>tuple of <float>, optional, default=[1]</em>) – List of aspect ratios of generated MultiBoxPriores.</li> |
| <li><strong>clip</strong> (<em>boolean, optional, default=0</em>) – Whether to clip out-of-boundary boxes.</li> |
| <li><strong>steps</strong> (<em>tuple of <float>, optional, default=[-1,-1]</em>) – Priorbox step across y and x, -1 for auto calculation.</li> |
| <li><strong>offsets</strong> (<em>tuple of <float>, optional, default=[0.5,0.5]</em>) – Priorbox center offsets, y and x respectively</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.MultiBoxTarget"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">MultiBoxTarget</code><span class="sig-paren">(</span><em>anchor=None</em>, <em>label=None</em>, <em>cls_pred=None</em>, <em>overlap_threshold=_Null</em>, <em>ignore_label=_Null</em>, <em>negative_mining_ratio=_Null</em>, <em>negative_mining_thresh=_Null</em>, <em>minimum_negative_samples=_Null</em>, <em>variances=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.MultiBoxTarget" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Compute Multibox training targets</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
| <li><strong>anchor</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Generated anchor boxes.</li> |
| <li><strong>label</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Object detection labels.</li> |
| <li><strong>cls_pred</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Class predictions.</li> |
| <li><strong>overlap_threshold</strong> (<em>float, optional, default=0.5</em>) – Anchor-GT overlap threshold to be regarded as a positive match.</li> |
| <li><strong>ignore_label</strong> (<em>float, optional, default=-1</em>) – Label for ignored anchors.</li> |
| <li><strong>negative_mining_ratio</strong> (<em>float, optional, default=-1</em>) – Max negative to positive samples ratio, use -1 to disable mining</li> |
| <li><strong>negative_mining_thresh</strong> (<em>float, optional, default=0.5</em>) – Threshold used for negative mining.</li> |
| <li><strong>minimum_negative_samples</strong> (<em>int, optional, default='0'</em>) – Minimum number of negative samples.</li> |
| <li><strong>variances</strong> (<em>tuple of <float>, optional, default=[0.1,0.1,0.2,0.2]</em>) – Variances to be encoded in box regression target.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.MultiProposal"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">MultiProposal</code><span class="sig-paren">(</span><em>cls_score=None</em>, <em>bbox_pred=None</em>, <em>im_info=None</em>, <em>rpn_pre_nms_top_n=_Null</em>, <em>rpn_post_nms_top_n=_Null</em>, <em>threshold=_Null</em>, <em>rpn_min_size=_Null</em>, <em>scales=_Null</em>, <em>ratios=_Null</em>, <em>feature_stride=_Null</em>, <em>output_score=_Null</em>, <em>iou_loss=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.MultiProposal" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Generate region proposals via RPN</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
| <li><strong>cls_score</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Score of how likely proposal is object.</li> |
| <li><strong>bbox_pred</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – BBox Predicted deltas from anchors for proposals</li> |
| <li><strong>im_info</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Image size and scale.</li> |
| <li><strong>rpn_pre_nms_top_n</strong> (<em>int, optional, default='6000'</em>) – Number of top scoring boxes to keep after applying NMS to RPN proposals</li> |
| <li><strong>rpn_post_nms_top_n</strong> (<em>int, optional, default='300'</em>) – Overlap threshold used for non-maximumsuppresion(suppress boxes with IoU >= this threshold</li> |
| <li><strong>threshold</strong> (<em>float, optional, default=0.7</em>) – NMS value, below which to suppress.</li> |
| <li><strong>rpn_min_size</strong> (<em>int, optional, default='16'</em>) – Minimum height or width in proposal</li> |
| <li><strong>scales</strong> (<em>tuple of <float>, optional, default=[4,8,16,32]</em>) – Used to generate anchor windows by enumerating scales</li> |
| <li><strong>ratios</strong> (<em>tuple of <float>, optional, default=[0.5,1,2]</em>) – Used to generate anchor windows by enumerating ratios</li> |
| <li><strong>feature_stride</strong> (<em>int, optional, default='16'</em>) – The size of the receptive field each unit in the convolution layer of the rpn,for example the product of all stride’s prior to this layer.</li> |
| <li><strong>output_score</strong> (<em>boolean, optional, default=0</em>) – Add score to outputs</li> |
| <li><strong>iou_loss</strong> (<em>boolean, optional, default=0</em>) – Usage of IoU Loss</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.PSROIPooling"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">PSROIPooling</code><span class="sig-paren">(</span><em>data=None</em>, <em>rois=None</em>, <em>spatial_scale=_Null</em>, <em>output_dim=_Null</em>, <em>pooled_size=_Null</em>, <em>group_size=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.PSROIPooling" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Performs region-of-interest pooling on inputs. Resize bounding box coordinates by spatial_scale and crop input feature maps accordingly. The cropped feature maps are pooled by max pooling to a fixed size output indicated by pooled_size. batch_size will change to the number of region bounding boxes after PSROIPooling</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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="../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Input data to the pooling operator, a 4D Feature maps</li> |
| <li><strong>rois</strong> (<a class="reference internal" href="../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Bounding box coordinates, a 2D array of [[batch_index, x1, y1, x2, y2]]. (x1, y1) and (x2, y2) are top left and down right corners of designated region of interest. batch_index indicates the index of corresponding image in the input data</li> |
| <li><strong>spatial_scale</strong> (<em>float, required</em>) – Ratio of input feature map height (or w) to raw image height (or w). Equals the reciprocal of total stride in convolutional layers</li> |
| <li><strong>output_dim</strong> (<em>int, required</em>) – fix output dim</li> |
| <li><strong>pooled_size</strong> (<em>int, required</em>) – fix pooled size</li> |
| <li><strong>group_size</strong> (<em>int, optional, default='0'</em>) – fix group size</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.Proposal"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">Proposal</code><span class="sig-paren">(</span><em>cls_score=None</em>, <em>bbox_pred=None</em>, <em>im_info=None</em>, <em>rpn_pre_nms_top_n=_Null</em>, <em>rpn_post_nms_top_n=_Null</em>, <em>threshold=_Null</em>, <em>rpn_min_size=_Null</em>, <em>scales=_Null</em>, <em>ratios=_Null</em>, <em>feature_stride=_Null</em>, <em>output_score=_Null</em>, <em>iou_loss=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.Proposal" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Generate region proposals via RPN</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
| <li><strong>cls_score</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Score of how likely proposal is object.</li> |
| <li><strong>bbox_pred</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – BBox Predicted deltas from anchors for proposals</li> |
| <li><strong>im_info</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Image size and scale.</li> |
| <li><strong>rpn_pre_nms_top_n</strong> (<em>int, optional, default='6000'</em>) – Number of top scoring boxes to keep after applying NMS to RPN proposals</li> |
| <li><strong>rpn_post_nms_top_n</strong> (<em>int, optional, default='300'</em>) – Overlap threshold used for non-maximumsuppresion(suppress boxes with IoU >= this threshold</li> |
| <li><strong>threshold</strong> (<em>float, optional, default=0.7</em>) – NMS value, below which to suppress.</li> |
| <li><strong>rpn_min_size</strong> (<em>int, optional, default='16'</em>) – Minimum height or width in proposal</li> |
| <li><strong>scales</strong> (<em>tuple of <float>, optional, default=[4,8,16,32]</em>) – Used to generate anchor windows by enumerating scales</li> |
| <li><strong>ratios</strong> (<em>tuple of <float>, optional, default=[0.5,1,2]</em>) – Used to generate anchor windows by enumerating ratios</li> |
| <li><strong>feature_stride</strong> (<em>int, optional, default='16'</em>) – The size of the receptive field each unit in the convolution layer of the rpn,for example the product of all stride’s prior to this layer.</li> |
| <li><strong>output_score</strong> (<em>boolean, optional, default=0</em>) – Add score to outputs</li> |
| <li><strong>iou_loss</strong> (<em>boolean, optional, default=0</em>) – Usage of IoU Loss</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.SparseEmbedding"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">SparseEmbedding</code><span class="sig-paren">(</span><em>data=None</em>, <em>weight=None</em>, <em>input_dim=_Null</em>, <em>output_dim=_Null</em>, <em>dtype=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.SparseEmbedding" 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>The storage type of weight must be <cite>row_sparse</cite>, and the gradient of the weight will be of |
| <cite>row_sparse</cite> storage type, too.</p> |
| <div class="admonition note"> |
| <p class="first admonition-title">Note</p> |
| <p class="last"><cite>SparseEmbedding</cite> is designed for the use case where <cite>input_dim</cite> is very large (e.g. 100k). |
| The operator is available on both CPU and GPU.</p> |
| </div> |
| <p>Examples:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span>input_dim = 4 |
| output_dim = 5 |
| |
| // Each row in weight matrix y represents a word. So, y = (w0,w1,w2,w3) |
| y = [[ 0., 1., 2., 3., 4.], |
| [ 5., 6., 7., 8., 9.], |
| [ 10., 11., 12., 13., 14.], |
| [ 15., 16., 17., 18., 19.]] |
| |
| // Input array x represents n-grams(2-gram). So, x = [(w1,w3), (w0,w2)] |
| x = [[ 1., 3.], |
| [ 0., 2.]] |
| |
| // Mapped input x to its vector representation y. |
| SparseEmbedding(x, y, 4, 5) = [[[ 5., 6., 7., 8., 9.], |
| [ 15., 16., 17., 18., 19.]], |
| |
| [[ 0., 1., 2., 3., 4.], |
| [ 10., 11., 12., 13., 14.]]] |
| </pre></div> |
| </div> |
| <p>Defined in src/operator/tensor/indexing_op.cc:L294</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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, required</em>) – Vocabulary size of the input indices.</li> |
| <li><strong>output_dim</strong> (<em>int, required</em>) – Dimension of the embedding vectors.</li> |
| <li><strong>dtype</strong> (<em>{'float16', 'float32', 'float64', 'int32', 'int64', 'int8', 'uint8'},optional, default='float32'</em>) – Data type of weight.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.bipartite_matching"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">bipartite_matching</code><span class="sig-paren">(</span><em>data=None</em>, <em>is_ascend=_Null</em>, <em>threshold=_Null</em>, <em>topk=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.bipartite_matching" title="Permalink to this definition">¶</a></dt> |
| <dd><dl class="docutils"> |
| <dt>Compute bipartite matching.</dt> |
| <dd><p class="first">The matching is performed on score matrix with shape [B, N, M] |
| - B: batch_size |
| - N: number of rows to match |
| - M: number of columns as reference to be matched against.</p> |
| <p>Returns: |
| x : matched column indices. -1 indicating non-matched elements in rows. |
| y : matched row indices.</p> |
| <p>Note:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span>Zero gradients are back-propagated in this op for now. |
| </pre></div> |
| </div> |
| <p>Example:</p> |
| <div class="last highlight-python"><div class="highlight"><pre><span></span><span class="n">s</span> <span class="o">=</span> <span class="p">[[</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.6</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.3</span><span class="p">,</span> <span class="mf">0.4</span><span class="p">]]</span> |
| <span class="n">x</span><span class="p">,</span> <span class="n">y</span> <span class="o">=</span> <span class="n">bipartite_matching</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">threshold</span><span class="o">=</span><span class="mf">1e-12</span><span class="p">,</span> <span class="n">is_ascend</span><span class="o">=</span><span class="bp">False</span><span class="p">)</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="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span> |
| <span class="n">y</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> |
| </pre></div> |
| </div> |
| </dd> |
| </dl> |
| <p>Defined in src/operator/contrib/bounding_box.cc:L169</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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>is_ascend</strong> (<em>boolean, optional, default=0</em>) – Use ascend order for scores instead of descending. Please set threshold accordingly.</li> |
| <li><strong>threshold</strong> (<em>float, required</em>) – Ignore matching when score < thresh, if is_ascend=false, or ignore score > thresh, if is_ascend=true.</li> |
| <li><strong>topk</strong> (<em>int, optional, default='-1'</em>) – Limit the number of matches to topk, set -1 for no limit</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.box_iou"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">box_iou</code><span class="sig-paren">(</span><em>lhs=None</em>, <em>rhs=None</em>, <em>format=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.box_iou" title="Permalink to this definition">¶</a></dt> |
| <dd><dl class="docutils"> |
| <dt>Bounding box overlap of two arrays.</dt> |
| <dd><p class="first">The overlap is defined as Intersection-over-Union, aka, IOU. |
| - lhs: (a_1, a_2, ..., a_n, 4) array |
| - rhs: (b_1, b_2, ..., b_n, 4) array |
| - output: (a_1, a_2, ..., a_n, b_1, b_2, ..., b_n) array</p> |
| <p>Note:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span>Zero gradients are back-propagated in this op for now. |
| </pre></div> |
| </div> |
| <p>Example:</p> |
| <div class="last highlight-python"><div class="highlight"><pre><span></span><span class="n">x</span> <span class="o">=</span> <span class="p">[[</span><span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">,</span> <span class="mf">1.0</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">,</span> <span class="mf">0.5</span><span class="p">]]</span> |
| <span class="n">y</span> <span class="o">=</span> <span class="p">[</span><span class="mf">0.25</span><span class="p">,</span> <span class="mf">0.25</span><span class="p">,</span> <span class="mf">0.75</span><span class="p">,</span> <span class="mf">0.75</span><span class="p">]</span> |
| <span class="n">box_iou</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">format</span><span class="o">=</span><span class="s1">'corner'</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span><span class="mf">0.1428</span><span class="p">],</span> <span class="p">[</span><span class="mf">0.1428</span><span class="p">]]</span> |
| </pre></div> |
| </div> |
| </dd> |
| </dl> |
| <p>Defined in src/operator/contrib/bounding_box.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>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>format</strong> (<em>{'center', 'corner'},optional, default='corner'</em>) – The box encoding type. |
| “corner” means boxes are encoded as [xmin, ymin, xmax, ymax], “center” means boxes are encodes as [x, y, width, height].</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.box_nms"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">box_nms</code><span class="sig-paren">(</span><em>data=None</em>, <em>overlap_thresh=_Null</em>, <em>topk=_Null</em>, <em>coord_start=_Null</em>, <em>score_index=_Null</em>, <em>id_index=_Null</em>, <em>force_suppress=_Null</em>, <em>in_format=_Null</em>, <em>out_format=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.box_nms" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Apply non-maximum suppression to input.</p> |
| <p>The output will be sorted in descending order according to <cite>score</cite>. Boxes with |
| overlaps larger than <cite>overlap_thresh</cite> and smaller scores will be removed and |
| filled with -1, the corresponding position will be recorded for backward propogation.</p> |
| <p>During back-propagation, the gradient will be copied to the original |
| position according to the input index. For positions that have been suppressed, |
| the in_grad will be assigned 0. |
| In summary, gradients are sticked to its boxes, will either be moved or discarded |
| according to its original index in input.</p> |
| <p>Input requirements: |
| 1. Input tensor have at least 2 dimensions, (n, k), any higher dims will be regarded |
| as batch, e.g. (a, b, c, d, n, k) == (a*b*c*d, n, k) |
| 2. n is the number of boxes in each batch |
| 3. k is the width of each box item.</p> |
| <p>By default, a box is [id, score, xmin, ymin, xmax, ymax, ...], |
| additional elements are allowed. |
| - <cite>id_index</cite>: optional, use -1 to ignore, useful if <cite>force_suppress=False</cite>, which means |
| we will skip highly overlapped boxes if one is <cite>apple</cite> while the other is <cite>car</cite>. |
| - <cite>coord_start</cite>: required, default=2, the starting index of the 4 coordinates. |
| Two formats are supported:</p> |
| <blockquote> |
| <div><cite>corner</cite>: [xmin, ymin, xmax, ymax] |
| <cite>center</cite>: [x, y, width, height]</div></blockquote> |
| <ul class="simple"> |
| <li><cite>score_index</cite>: required, default=1, box score/confidence.</li> |
| </ul> |
| <p>When two boxes overlap IOU > <cite>overlap_thresh</cite>, the one with smaller score will be suppressed. |
| - <cite>in_format</cite> and <cite>out_format</cite>: default=’corner’, specify in/out box formats.</p> |
| <p>Examples:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span>x = [[0, 0.5, 0.1, 0.1, 0.2, 0.2], [1, 0.4, 0.1, 0.1, 0.2, 0.2], |
| [0, 0.3, 0.1, 0.1, 0.14, 0.14], [2, 0.6, 0.5, 0.5, 0.7, 0.8]] |
| box_nms(x, overlap_thresh=0.1, coord_start=2, score_index=1, id_index=0, |
| force_suppress=True, in_format='corner', out_typ='corner') = |
| [[2, 0.6, 0.5, 0.5, 0.7, 0.8], [0, 0.5, 0.1, 0.1, 0.2, 0.2], |
| [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]] |
| out_grad = [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1], [0.2, 0.2, 0.2, 0.2, 0.2, 0.2], |
| [0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]] |
| # exe.backward |
| in_grad = [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0, 0, 0, 0, 0, 0], |
| [0, 0, 0, 0, 0, 0], [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]] |
| </pre></div> |
| </div> |
| <p>Defined in src/operator/contrib/bounding_box.cc:L82</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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>overlap_thresh</strong> (<em>float, optional, default=0.5</em>) – Overlapping(IoU) threshold to suppress object with smaller score.</li> |
| <li><strong>topk</strong> (<em>int, optional, default='-1'</em>) – Apply nms to topk boxes with descending scores, -1 to no restriction.</li> |
| <li><strong>coord_start</strong> (<em>int, optional, default='2'</em>) – Start index of the consecutive 4 coordinates.</li> |
| <li><strong>score_index</strong> (<em>int, optional, default='1'</em>) – Index of the scores/confidence of boxes.</li> |
| <li><strong>id_index</strong> (<em>int, optional, default='-1'</em>) – Optional, index of the class categories, -1 to disable.</li> |
| <li><strong>force_suppress</strong> (<em>boolean, optional, default=0</em>) – Optional, if set false and id_index is provided, nms will only apply to boxes belongs to the same category</li> |
| <li><strong>in_format</strong> (<em>{'center', 'corner'},optional, default='corner'</em>) – The input box encoding type. |
| “corner” means boxes are encoded as [xmin, ymin, xmax, ymax], “center” means boxes are encodes as [x, y, width, height].</li> |
| <li><strong>out_format</strong> (<em>{'center', 'corner'},optional, default='corner'</em>) – The output box encoding type. |
| “corner” means boxes are encoded as [xmin, ymin, xmax, ymax], “center” means boxes are encodes as [x, y, width, height].</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.box_non_maximum_suppression"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">box_non_maximum_suppression</code><span class="sig-paren">(</span><em>data=None</em>, <em>overlap_thresh=_Null</em>, <em>topk=_Null</em>, <em>coord_start=_Null</em>, <em>score_index=_Null</em>, <em>id_index=_Null</em>, <em>force_suppress=_Null</em>, <em>in_format=_Null</em>, <em>out_format=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.box_non_maximum_suppression" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Apply non-maximum suppression to input.</p> |
| <p>The output will be sorted in descending order according to <cite>score</cite>. Boxes with |
| overlaps larger than <cite>overlap_thresh</cite> and smaller scores will be removed and |
| filled with -1, the corresponding position will be recorded for backward propogation.</p> |
| <p>During back-propagation, the gradient will be copied to the original |
| position according to the input index. For positions that have been suppressed, |
| the in_grad will be assigned 0. |
| In summary, gradients are sticked to its boxes, will either be moved or discarded |
| according to its original index in input.</p> |
| <p>Input requirements: |
| 1. Input tensor have at least 2 dimensions, (n, k), any higher dims will be regarded |
| as batch, e.g. (a, b, c, d, n, k) == (a*b*c*d, n, k) |
| 2. n is the number of boxes in each batch |
| 3. k is the width of each box item.</p> |
| <p>By default, a box is [id, score, xmin, ymin, xmax, ymax, ...], |
| additional elements are allowed. |
| - <cite>id_index</cite>: optional, use -1 to ignore, useful if <cite>force_suppress=False</cite>, which means |
| we will skip highly overlapped boxes if one is <cite>apple</cite> while the other is <cite>car</cite>. |
| - <cite>coord_start</cite>: required, default=2, the starting index of the 4 coordinates. |
| Two formats are supported:</p> |
| <blockquote> |
| <div><cite>corner</cite>: [xmin, ymin, xmax, ymax] |
| <cite>center</cite>: [x, y, width, height]</div></blockquote> |
| <ul class="simple"> |
| <li><cite>score_index</cite>: required, default=1, box score/confidence.</li> |
| </ul> |
| <p>When two boxes overlap IOU > <cite>overlap_thresh</cite>, the one with smaller score will be suppressed. |
| - <cite>in_format</cite> and <cite>out_format</cite>: default=’corner’, specify in/out box formats.</p> |
| <p>Examples:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span>x = [[0, 0.5, 0.1, 0.1, 0.2, 0.2], [1, 0.4, 0.1, 0.1, 0.2, 0.2], |
| [0, 0.3, 0.1, 0.1, 0.14, 0.14], [2, 0.6, 0.5, 0.5, 0.7, 0.8]] |
| box_nms(x, overlap_thresh=0.1, coord_start=2, score_index=1, id_index=0, |
| force_suppress=True, in_format='corner', out_typ='corner') = |
| [[2, 0.6, 0.5, 0.5, 0.7, 0.8], [0, 0.5, 0.1, 0.1, 0.2, 0.2], |
| [-1, -1, -1, -1, -1, -1], [-1, -1, -1, -1, -1, -1]] |
| out_grad = [[0.1, 0.1, 0.1, 0.1, 0.1, 0.1], [0.2, 0.2, 0.2, 0.2, 0.2, 0.2], |
| [0.3, 0.3, 0.3, 0.3, 0.3, 0.3], [0.4, 0.4, 0.4, 0.4, 0.4, 0.4]] |
| # exe.backward |
| in_grad = [[0.2, 0.2, 0.2, 0.2, 0.2, 0.2], [0, 0, 0, 0, 0, 0], |
| [0, 0, 0, 0, 0, 0], [0.1, 0.1, 0.1, 0.1, 0.1, 0.1]] |
| </pre></div> |
| </div> |
| <p>Defined in src/operator/contrib/bounding_box.cc:L82</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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>overlap_thresh</strong> (<em>float, optional, default=0.5</em>) – Overlapping(IoU) threshold to suppress object with smaller score.</li> |
| <li><strong>topk</strong> (<em>int, optional, default='-1'</em>) – Apply nms to topk boxes with descending scores, -1 to no restriction.</li> |
| <li><strong>coord_start</strong> (<em>int, optional, default='2'</em>) – Start index of the consecutive 4 coordinates.</li> |
| <li><strong>score_index</strong> (<em>int, optional, default='1'</em>) – Index of the scores/confidence of boxes.</li> |
| <li><strong>id_index</strong> (<em>int, optional, default='-1'</em>) – Optional, index of the class categories, -1 to disable.</li> |
| <li><strong>force_suppress</strong> (<em>boolean, optional, default=0</em>) – Optional, if set false and id_index is provided, nms will only apply to boxes belongs to the same category</li> |
| <li><strong>in_format</strong> (<em>{'center', 'corner'},optional, default='corner'</em>) – The input box encoding type. |
| “corner” means boxes are encoded as [xmin, ymin, xmax, ymax], “center” means boxes are encodes as [x, y, width, height].</li> |
| <li><strong>out_format</strong> (<em>{'center', 'corner'},optional, default='corner'</em>) – The output box encoding type. |
| “corner” means boxes are encoded as [xmin, ymin, xmax, ymax], “center” means boxes are encodes as [x, y, width, height].</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.count_sketch"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">count_sketch</code><span class="sig-paren">(</span><em>data=None</em>, <em>h=None</em>, <em>s=None</em>, <em>out_dim=_Null</em>, <em>processing_batch_size=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.count_sketch" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Apply CountSketch to input: map a d-dimension data to k-dimension data”</p> |
| <div class="admonition note"> |
| <p class="first admonition-title">Note</p> |
| <p class="last"><cite>count_sketch</cite> is only available on GPU.</p> |
| </div> |
| <p>Assume input data has shape (N, d), sign hash table s has shape (N, d), |
| index hash table h has shape (N, d) and mapping dimension out_dim = k, |
| each element in s is either +1 or -1, each element in h is random integer from 0 to k-1. |
| Then the operator computs:</p> |
| <div class="math"> |
| \[out[h[i]] += data[i] * s[i]\]</div> |
| <p>Example:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">out_dim</span> <span class="o">=</span> <span class="mi">5</span> |
| <span class="n">x</span> <span class="o">=</span> <span class="p">[[</span><span class="mf">1.2</span><span class="p">,</span> <span class="mf">2.5</span><span class="p">,</span> <span class="mf">3.4</span><span class="p">],[</span><span class="mf">3.2</span><span class="p">,</span> <span class="mf">5.7</span><span class="p">,</span> <span class="mf">6.6</span><span class="p">]]</span> |
| <span class="n">h</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="mi">4</span><span class="p">]]</span> |
| <span class="n">s</span> <span class="o">=</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="p">,</span> <span class="mi">1</span><span class="p">]]</span> |
| <span class="n">mx</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">ndarray</span><span class="o">.</span><span class="n">count_sketch</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">x</span><span class="p">,</span> <span class="n">h</span><span class="o">=</span><span class="n">h</span><span class="p">,</span> <span class="n">s</span><span class="o">=</span><span class="n">s</span><span class="p">,</span> <span class="n">out_dim</span> <span class="o">=</span> <span class="mi">5</span><span class="p">)</span> <span class="o">=</span> <span class="p">[[</span><span class="mf">1.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="o">-</span><span class="mf">2.5</span><span class="p">,</span> <span class="mf">3.4</span><span class="p">],</span> |
| <span class="p">[</span><span class="mf">3.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="o">-</span><span class="mf">5.7</span><span class="p">,</span> <span class="mf">6.6</span><span class="p">]]</span> |
| </pre></div> |
| </div> |
| <p>Defined in src/operator/contrib/count_sketch.cc:L67</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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 CountSketchOp.</li> |
| <li><strong>h</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The index vector</li> |
| <li><strong>s</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The sign vector</li> |
| <li><strong>out_dim</strong> (<em>int, required</em>) – The output dimension.</li> |
| <li><strong>processing_batch_size</strong> (<em>int, optional, default='32'</em>) – How many sketch vectors to process at one time.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.ctc_loss"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">ctc_loss</code><span class="sig-paren">(</span><em>data=None</em>, <em>label=None</em>, <em>data_lengths=None</em>, <em>label_lengths=None</em>, <em>use_data_lengths=_Null</em>, <em>use_label_lengths=_Null</em>, <em>blank_label=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.ctc_loss" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Connectionist Temporal Classification Loss.</p> |
| <p>The shapes of the inputs and outputs:</p> |
| <ul class="simple"> |
| <li><strong>data</strong>: <cite>(sequence_length, batch_size, alphabet_size)</cite></li> |
| <li><strong>label</strong>: <cite>(batch_size, label_sequence_length)</cite></li> |
| <li><strong>out</strong>: <cite>(batch_size)</cite></li> |
| </ul> |
| <p>The <cite>data</cite> tensor consists of sequences of activation vectors (without applying softmax), |
| with i-th channel in the last dimension corresponding to i-th label |
| for i between 0 and alphabet_size-1 (i.e always 0-indexed). |
| Alphabet size should include one additional value reserved for blank label. |
| When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, the <code class="docutils literal"><span class="pre">0</span></code>-th channel is be reserved for |
| activation of blank label, or otherwise if it is “last”, <code class="docutils literal"><span class="pre">(alphabet_size-1)</span></code>-th channel should be |
| reserved for blank label.</p> |
| <p><code class="docutils literal"><span class="pre">label</span></code> is an index matrix of integers. When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, |
| the value 0 is then reserved for blank label, and should not be passed in this matrix. Otherwise, |
| when <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"last"</span></code>, the value <cite>(alphabet_size-1)</cite> is reserved for blank label.</p> |
| <p>If a sequence of labels is shorter than <em>label_sequence_length</em>, use the special |
| padding value at the end of the sequence to conform it to the correct |
| length. The padding value is <cite>0</cite> when <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, and <cite>-1</cite> otherwise.</p> |
| <p>For example, suppose the vocabulary is <cite>[a, b, c]</cite>, and in one batch we have three sequences |
| ‘ba’, ‘cbb’, and ‘abac’. When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"first"</span></code>, we can index the labels as |
| <cite>{‘a’: 1, ‘b’: 2, ‘c’: 3}</cite>, and we reserve the 0-th channel for blank label in data tensor. |
| The resulting <cite>label</cite> tensor should be padded to be:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></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="mi">0</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="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">3</span><span class="p">]]</span> |
| </pre></div> |
| </div> |
| <p>When <cite>blank_label</cite> is <code class="docutils literal"><span class="pre">"last"</span></code>, we can index the labels as |
| <cite>{‘a’: 0, ‘b’: 1, ‘c’: 2}</cite>, and we reserve the channel index 3 for blank label in data tensor. |
| The resulting <cite>label</cite> tensor should be padded to be:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></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="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</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">1</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">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">]]</span> |
| </pre></div> |
| </div> |
| <p><code class="docutils literal"><span class="pre">out</span></code> is a list of CTC loss values, one per example in the batch.</p> |
| <p>See <em>Connectionist Temporal Classification: Labelling Unsegmented |
| Sequence Data with Recurrent Neural Networks</em>, A. Graves <em>et al</em>. for more |
| information on the definition and the algorithm.</p> |
| <p>Defined in src/operator/contrib/ctc_loss.cc:L115</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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 ctc_loss op.</li> |
| <li><strong>label</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Ground-truth labels for the loss.</li> |
| <li><strong>data_lengths</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Lengths of data for each of the samples. Only required when use_data_lengths is true.</li> |
| <li><strong>label_lengths</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Lengths of labels for each of the samples. Only required when use_label_lengths is true.</li> |
| <li><strong>use_data_lengths</strong> (<em>boolean, optional, default=0</em>) – Whether the data lenghts are decided by <cite>data_lengths</cite>. If false, the lengths are equal to the max sequence length.</li> |
| <li><strong>use_label_lengths</strong> (<em>boolean, optional, default=0</em>) – Whether the label lenghts are decided by <cite>label_lengths</cite>, or derived from <cite>padding_mask</cite>. If false, the lengths are derived from the first occurrence of the value of <cite>padding_mask</cite>. The value of <cite>padding_mask</cite> is <code class="docutils literal"><span class="pre">0</span></code> when first CTC label is reserved for blank, and <code class="docutils literal"><span class="pre">-1</span></code> when last label is reserved for blank. See <cite>blank_label</cite>.</li> |
| <li><strong>blank_label</strong> (<em>{'first', 'last'},optional, default='first'</em>) – Set the label that is reserved for blank label.If “first”, 0-th label is reserved, and label values for tokens in the vocabulary are between <code class="docutils literal"><span class="pre">1</span></code> and <code class="docutils literal"><span class="pre">alphabet_size-1</span></code>, and the padding mask is <code class="docutils literal"><span class="pre">-1</span></code>. If “last”, last label value <code class="docutils literal"><span class="pre">alphabet_size-1</span></code> is reserved for blank label instead, and label values for tokens in the vocabulary are between <code class="docutils literal"><span class="pre">0</span></code> and <code class="docutils literal"><span class="pre">alphabet_size-2</span></code>, and the padding mask is <code class="docutils literal"><span class="pre">0</span></code>.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.dequantize"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">dequantize</code><span class="sig-paren">(</span><em>input=None</em>, <em>min_range=None</em>, <em>max_range=None</em>, <em>out_type=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.dequantize" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Dequantize the input tensor into a float tensor. |
| [min_range, max_range] are scalar floats that spcify the range for |
| the output data.</p> |
| <p>Each value of the tensor will undergo the following:</p> |
| <p><cite>out[i] = min_range + (in[i] * (max_range - min_range) / range(INPUT_TYPE))</cite></p> |
| <p>here <cite>range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()</cite></p> |
| <p>Defined in src/operator/contrib/dequantize.cc:L41</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
| <li><strong>input</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – A ndarray/symbol of type <cite>uint8</cite></li> |
| <li><strong>min_range</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The minimum scalar value possibly produced for the input</li> |
| <li><strong>max_range</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The maximum scalar value possibly produced for the input</li> |
| <li><strong>out_type</strong> (<em>{'float32'}, required</em>) – Output data type.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.fft"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">fft</code><span class="sig-paren">(</span><em>data=None</em>, <em>compute_size=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.fft" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Apply 1D FFT to input”</p> |
| <div class="admonition note"> |
| <p class="first admonition-title">Note</p> |
| <p class="last"><cite>fft</cite> is only available on GPU.</p> |
| </div> |
| <p>Currently accept 2 input data shapes: (N, d) or (N1, N2, N3, d), data can only be real numbers. |
| The output data has shape: (N, 2*d) or (N1, N2, N3, 2*d). The format is: [real0, imag0, real1, imag1, ...].</p> |
| <p>Example:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">data</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</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">4</span><span class="p">))</span> |
| <span class="n">out</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">ndarray</span><span class="o">.</span><span class="n">fft</span><span class="p">(</span><span class="n">data</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="n">data</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">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">)))</span> |
| </pre></div> |
| </div> |
| <p>Defined in src/operator/contrib/fft.cc:L56</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <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 FFTOp.</li> |
| <li><strong>compute_size</strong> (<em>int, optional, default='128'</em>) – Maximum size of sub-batch to be forwarded at one time</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.ifft"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">ifft</code><span class="sig-paren">(</span><em>data=None</em>, <em>compute_size=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.ifft" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Apply 1D ifft to input”</p> |
| <div class="admonition note"> |
| <p class="first admonition-title">Note</p> |
| <p class="last"><cite>ifft</cite> is only available on GPU.</p> |
| </div> |
| <p>Currently accept 2 input data shapes: (N, d) or (N1, N2, N3, d). Data is in format: [real0, imag0, real1, imag1, ...]. |
| Last dimension must be an even number. |
| The output data has shape: (N, d/2) or (N1, N2, N3, d/2). It is only the real part of the result.</p> |
| <p>Example:</p> |
| <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">data</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</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">4</span><span class="p">))</span> |
| <span class="n">out</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">contrib</span><span class="o">.</span><span class="n">ndarray</span><span class="o">.</span><span class="n">ifft</span><span class="p">(</span><span class="n">data</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="n">data</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">gpu</span><span class="p">(</span><span class="mi">0</span><span class="p">)))</span> |
| </pre></div> |
| </div> |
| <p>Defined in src/operator/contrib/ifft.cc:L58</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
| <li><strong>data</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data to the IFFTOp.</li> |
| <li><strong>compute_size</strong> (<em>int, optional, default='128'</em>) – Maximum size of sub-batch to be forwarded at one time</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.ndarray.contrib.quantize"> |
| <code class="descclassname">mxnet.ndarray.contrib.</code><code class="descname">quantize</code><span class="sig-paren">(</span><em>input=None</em>, <em>min_range=None</em>, <em>max_range=None</em>, <em>out_type=_Null</em>, <em>out=None</em>, <em>name=None</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#mxnet.ndarray.contrib.quantize" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Quantize a input tensor from float to <cite>out_type</cite>, |
| with user-specified <cite>min_range</cite> and <cite>max_range</cite>.</p> |
| <p>[min_range, max_range] are scalar floats that spcify the range for |
| the input data. Each value of the tensor will undergo the following:</p> |
| <p><cite>out[i] = (in[i] - min_range) * range(OUTPUT_TYPE) / (max_range - min_range)</cite></p> |
| <p>here <cite>range(T) = numeric_limits<T>::max() - numeric_limits<T>::min()</cite></p> |
| <p>Defined in src/operator/contrib/quantize.cc:L41</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple"> |
| <li><strong>input</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – A ndarray/symbol of type <cite>float32</cite></li> |
| <li><strong>min_range</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The minimum scalar value possibly produced for the input</li> |
| <li><strong>max_range</strong> (<a class="reference internal" href="ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The maximum scalar value possibly produced for the input</li> |
| <li><strong>out_type</strong> (<em>{'uint8'},optional, default='uint8'</em>) – Output data type.</li> |
| <li><strong>out</strong> (<em>NDArray, optional</em>) – The output NDArray to hold the result.</li> |
| </ul> |
| </td> |
| </tr> |
| <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>out</strong> – |
| The output of this function.</p> |
| </td> |
| </tr> |
| <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"><p class="first last">NDArray or list of NDArrays</p> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <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="#">Contrib NDArray API</a><ul> |
| <li><a class="reference internal" href="#overview">Overview</a></li> |
| <li><a class="reference internal" href="#contrib">Contrib</a></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 type="text/javascript"> |
| $('body').ready(function () { |
| $('body').css('visibility', 'visible'); |
| }); |
| </script> |
| </body> |
| </html> |