| <!DOCTYPE html> |
| |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"/> |
| <meta content="IE=edge" http-equiv="X-UA-Compatible"/> |
| <meta content="width=device-width, initial-scale=1" name="viewport"/> |
| <meta content="Random Distribution Generator Symbol API" property="og:title"> |
| <meta content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" property="og:image"> |
| <meta content="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/og-logo.png" property="og:image:secure_url"> |
| <meta content="Random Distribution Generator Symbol API" property="og:description"/> |
| <title>Random Distribution Generator Symbol API — mxnet documentation</title> |
| <link crossorigin="anonymous" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" rel="stylesheet"/> |
| <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/> |
| <link href="../../../_static/basic.css" rel="stylesheet" type="text/css"> |
| <link href="../../../_static/pygments.css" rel="stylesheet" type="text/css"> |
| <link href="../../../_static/mxnet.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript"> |
| var DOCUMENTATION_OPTIONS = { |
| URL_ROOT: '../../../', |
| VERSION: '', |
| COLLAPSE_INDEX: false, |
| FILE_SUFFIX: '.html', |
| HAS_SOURCE: true, |
| SOURCELINK_SUFFIX: '.txt' |
| }; |
| </script> |
| <script src="https://code.jquery.com/jquery-1.11.1.min.js" type="text/javascript"></script> |
| <script src="../../../_static/underscore.js" type="text/javascript"></script> |
| <script src="../../../_static/searchtools_custom.js" type="text/javascript"></script> |
| <script src="../../../_static/doctools.js" type="text/javascript"></script> |
| <script src="../../../_static/selectlang.js" type="text/javascript"></script> |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML" type="text/javascript"></script> |
| <script type="text/javascript"> jQuery(function() { Search.loadIndex("/searchindex.js"); Search.init();}); </script> |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new |
| Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-96378503-1', 'auto'); |
| ga('send', 'pageview'); |
| |
| </script> |
| <!-- --> |
| <!-- <script type="text/javascript" src="../../../_static/jquery.js"></script> --> |
| <!-- --> |
| <!-- <script type="text/javascript" src="../../../_static/underscore.js"></script> --> |
| <!-- --> |
| <!-- <script type="text/javascript" src="../../../_static/doctools.js"></script> --> |
| <!-- --> |
| <!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> --> |
| <!-- --> |
| <link href="../../../genindex.html" rel="index" title="Index"> |
| <link href="../../../search.html" rel="search" title="Search"/> |
| <link href="../index.html" rel="up" title="MXNet - Python API"/> |
| <link href="linalg.html" rel="next" title="Linear Algebra Symbol API"/> |
| <link href="symbol.html" rel="prev" title="Symbol API"/> |
| <link href="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-icon.png" rel="icon" type="image/png"/> |
| </link></link></link></meta></meta></meta></head> |
| <body background="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet-background-compressed.jpeg" role="document"> |
| <div class="content-block"><div class="navbar navbar-fixed-top"> |
| <div class="container" id="navContainer"> |
| <div class="innder" id="header-inner"> |
| <h1 id="logo-wrap"> |
| <a href="../../../" id="logo"><img src="https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/image/mxnet_logo.png"/></a> |
| </h1> |
| <nav class="nav-bar" id="main-nav"> |
| <a class="main-nav-link" href="../../../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/c++/index.html">C++</a></li> |
| <li><a class="main-nav-link" href="../../../api/clojure/index.html">Clojure</a></li> |
| <li><a class="main-nav-link" href="../../../api/julia/index.html">Julia</a></li> |
| <li><a class="main-nav-link" href="../../../api/perl/index.html">Perl</a></li> |
| <li><a class="main-nav-link" href="../../../api/r/index.html">R</a></li> |
| <li><a class="main-nav-link" href="../../../api/scala/index.html">Scala</a></li> |
| </ul> |
| </span> |
| <span id="dropdown-menu-position-anchor-docs"> |
| <a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Docs <span class="caret"></span></a> |
| <ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-docs"> |
| <li><a class="main-nav-link" href="../../../faq/index.html">FAQ</a></li> |
| <li><a class="main-nav-link" href="../../../tutorials/index.html">Tutorials</a> |
| <li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet/tree/1.2.1/example">Examples</a></li> |
| <li><a class="main-nav-link" href="../../../architecture/index.html">Architecture</a></li> |
| <li><a class="main-nav-link" href="../../../api/python/gluon/model_zoo.html">Model Zoo</a></li> |
| <li><a class="main-nav-link" href="../../../api/python/contrib/onnx.html">ONNX</a></li> |
| </li></ul> |
| </span> |
| <span id="dropdown-menu-position-anchor-community"> |
| <a aria-expanded="true" aria-haspopup="true" class="main-nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button">Community <span class="caret"></span></a> |
| <ul class="dropdown-menu navbar-menu" id="package-dropdown-menu-community"> |
| <li><a class="main-nav-link" href="http://discuss.mxnet.io">Forum</a></li> |
| <li><a class="main-nav-link" href="https://github.com/apache/incubator-mxnet">Github</a></li> |
| <li><a class="main-nav-link" href="../../../community/contribute.html">Contribute</a></li> |
| <li><a class="main-nav-link" href="../../../community/ecosystem.html">Ecosystem</a></li> |
| <li><a class="main-nav-link" href="../../../community/powered_by.html">Powered By</a></li> |
| </ul> |
| </span> |
| <span id="dropdown-menu-position-anchor-version" style="position: relative"><a href="#" class="main-nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true">Versions(1.2.1)<span class="caret"></span></a><ul id="package-dropdown-menu" class="dropdown-menu"><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/>master</a></li><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/versions/1.2.1/index.html>1.2.1</a></li><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/versions/1.1.0/index.html>1.1.0</a></li><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/versions/1.0.0/index.html>1.0.0</a></li><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/versions/0.12.1/index.html>0.12.1</a></li><li><a class="main-nav-link" href=http://mxnet.incubator.apache.org/versions/0.11.0/index.html>0.11.0</a></li></ul></span></nav> |
| <script> function getRootPath(){ return "../../../" } </script> |
| <div class="burgerIcon dropdown"> |
| <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button">☰</a> |
| <ul class="dropdown-menu" id="burgerMenu"> |
| <li><a href="../../../install/index.html">Install</a></li> |
| <li><a class="main-nav-link" href="../../../tutorials/index.html">Tutorials</a></li> |
| <li class="dropdown-submenu dropdown"> |
| <a aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" role="button" tabindex="-1">Community</a> |
| <ul class="dropdown-menu"> |
| <li><a href="http://discuss.mxnet.io" tabindex="-1">Forum</a></li> |
| <li><a href="https://github.com/apache/incubator-mxnet" tabindex="-1">Github</a></li> |
| <li><a href="../../../community/contribute.html" tabindex="-1">Contribute</a></li> |
| <li><a href="../../../community/ecosystem.html" tabindex="-1">Ecosystem</a></li> |
| <li><a href="../../../community/powered_by.html" tabindex="-1">Powered By</a></li> |
| </ul> |
| </li> |
| <li class="dropdown-submenu"> |
| <a aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" role="button" tabindex="-1">API</a> |
| <ul class="dropdown-menu"> |
| <li><a href="../../../api/python/index.html" tabindex="-1">Python</a> |
| </li> |
| <li><a href="../../../api/c++/index.html" tabindex="-1">C++</a> |
| </li> |
| <li><a href="../../../api/clojure/index.html" tabindex="-1">Clojure</a> |
| </li> |
| <li><a href="../../../api/julia/index.html" tabindex="-1">Julia</a> |
| </li> |
| <li><a href="../../../api/perl/index.html" tabindex="-1">Perl</a> |
| </li> |
| <li><a href="../../../api/r/index.html" tabindex="-1">R</a> |
| </li> |
| <li><a href="../../../api/scala/index.html" tabindex="-1">Scala</a> |
| </li> |
| </ul> |
| </li> |
| <li class="dropdown-submenu"> |
| <a aria-expanded="true" aria-haspopup="true" class="dropdown-toggle burger-link" data-toggle="dropdown" href="#" tabindex="-1">Docs</a> |
| <ul class="dropdown-menu"> |
| <li><a href="../../../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.2.1/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 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.2.1)</a><ul class="dropdown-menu"><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/>master</a></li><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/versions/1.2.1/index.html>1.2.1</a></li><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/versions/1.1.0/index.html>1.1.0</a></li><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/versions/1.0.0/index.html>1.0.0</a></li><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/versions/0.12.1/index.html>0.12.1</a></li><li><a tabindex="-1" href=http://mxnet.incubator.apache.org/versions/0.11.0/index.html>0.11.0</a></li></ul></li></ul> |
| </div> |
| <div class="plusIcon dropdown"> |
| <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button"><span aria-hidden="true" class="glyphicon glyphicon-plus"></span></a> |
| <ul class="dropdown-menu dropdown-menu-right" id="plusMenu"></ul> |
| </div> |
| <div id="search-input-wrap"> |
| <form action="../../../search.html" autocomplete="off" class="" method="get" role="search"> |
| <div class="form-group inner-addon left-addon"> |
| <i class="glyphicon glyphicon-search"></i> |
| <input class="form-control" name="q" placeholder="Search" type="text"/> |
| </div> |
| <input name="check_keywords" type="hidden" value="yes"> |
| <input name="area" type="hidden" value="default"/> |
| </input></form> |
| <div id="search-preview"></div> |
| </div> |
| <div id="searchIcon"> |
| <span aria-hidden="true" class="glyphicon glyphicon-search"></span> |
| </div> |
| <!-- <div id="lang-select-wrap"> --> |
| <!-- <label id="lang-select-label"> --> |
| <!-- <\!-- <i class="fa fa-globe"></i> -\-> --> |
| <!-- <span></span> --> |
| <!-- </label> --> |
| <!-- <select id="lang-select"> --> |
| <!-- <option value="en">Eng</option> --> |
| <!-- <option value="zh">中文</option> --> |
| <!-- </select> --> |
| <!-- </div> --> |
| <!-- <a id="mobile-nav-toggle"> |
| <span class="mobile-nav-toggle-bar"></span> |
| <span class="mobile-nav-toggle-bar"></span> |
| <span class="mobile-nav-toggle-bar"></span> |
| </a> --> |
| </div> |
| </div> |
| </div> |
| <script type="text/javascript"> |
| $('body').css('background', 'white'); |
| </script> |
| <div class="container"> |
| <div class="row"> |
| <div aria-label="main navigation" class="sphinxsidebar leftsidebar" role="navigation"> |
| <div class="sphinxsidebarwrapper"> |
| <ul class="current"> |
| <li class="toctree-l1 current"><a class="reference internal" href="../index.html">Python Documents</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../index.html#ndarray-api">NDArray API</a></li> |
| <li class="toctree-l2 current"><a class="reference internal" href="../index.html#symbol-api">Symbol API</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="symbol.html">Symbol API</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">Random Distribution Generator Symbol 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="#random-distribution-generator">Random Distribution Generator</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="#api-reference">API Reference</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="linalg.html">Linear Algebra Symbol API</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="sparse.html">Sparse Symbol API</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="contrib.html">Contrib Symbol API</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="rnn.html">RNN Cell Symbol API</a></li> |
| </ul> |
| </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#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#profiler-api">Profiler 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/contribute.html">Community</a></li> |
| </ul> |
| </div> |
| </div> |
| <div class="content"> |
| <div class="page-tracker"></div> |
| <div class="section" id="random-distribution-generator-symbol-api"> |
| <span id="random-distribution-generator-symbol-api"></span><h1>Random Distribution Generator Symbol API<a class="headerlink" href="#random-distribution-generator-symbol-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 random distribution generator routines of the symbolic expression 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="symbol.html#module-mxnet.symbol.random" title="mxnet.symbol.random"><code class="xref py py-obj docutils literal"><span class="pre">mxnet.symbol.random</span></code></a></td> |
| <td>Random distribution generator Symbol API of MXNet.</td> |
| </tr> |
| </tbody> |
| </table> |
| <p>The <code class="docutils literal"><span class="pre">Random</span> <span class="pre">Distribution</span> <span class="pre">Generator</span> <span class="pre">Symbol</span></code> API, defined in the <code class="docutils literal"><span class="pre">symbol.random</span></code> package, provides |
| symbolic expressions for random distribution generator routines.</p> |
| <p>In the rest of this document, we list routines provided by the <code class="docutils literal"><span class="pre">symbol.random</span></code> package.</p> |
| </div> |
| <div class="section" id="random-distribution-generator"> |
| <span id="random-distribution-generator"></span><h2>Random Distribution Generator<a class="headerlink" href="#random-distribution-generator" 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="symbol.html#mxnet.symbol.random.exponential" title="mxnet.symbol.random.exponential"><code class="xref py py-obj docutils literal"><span class="pre">exponential</span></code></a></td> |
| <td>Draw samples from an exponential distribution.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.gamma" title="mxnet.symbol.random.gamma"><code class="xref py py-obj docutils literal"><span class="pre">gamma</span></code></a></td> |
| <td>Draw random samples from a gamma distribution.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.generalized_negative_binomial" title="mxnet.symbol.random.generalized_negative_binomial"><code class="xref py py-obj docutils literal"><span class="pre">generalized_negative_binomial</span></code></a></td> |
| <td>Draw random samples from a generalized negative binomial distribution.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.negative_binomial" title="mxnet.symbol.random.negative_binomial"><code class="xref py py-obj docutils literal"><span class="pre">negative_binomial</span></code></a></td> |
| <td>Draw random samples from a negative binomial distribution.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.normal" title="mxnet.symbol.random.normal"><code class="xref py py-obj docutils literal"><span class="pre">normal</span></code></a></td> |
| <td>Draw random samples from a normal (Gaussian) distribution.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.poisson" title="mxnet.symbol.random.poisson"><code class="xref py py-obj docutils literal"><span class="pre">poisson</span></code></a></td> |
| <td>Draw random samples from a Poisson distribution.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.uniform" title="mxnet.symbol.random.uniform"><code class="xref py py-obj docutils literal"><span class="pre">uniform</span></code></a></td> |
| <td>Draw random samples from a uniform distribution.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.multinomial" title="mxnet.symbol.random.multinomial"><code class="xref py py-obj docutils literal"><span class="pre">multinomial</span></code></a></td> |
| <td>Concurrent sampling from multiple multinomial distributions.</td> |
| </tr> |
| <tr class="row-odd"><td><a class="reference internal" href="symbol.html#mxnet.symbol.random.shuffle" title="mxnet.symbol.random.shuffle"><code class="xref py py-obj docutils literal"><span class="pre">shuffle</span></code></a></td> |
| <td>Shuffle the elements randomly.</td> |
| </tr> |
| <tr class="row-even"><td><a class="reference internal" href="#mxnet.random.seed" title="mxnet.random.seed"><code class="xref py py-obj docutils literal"><span class="pre">mxnet.random.seed</span></code></a></td> |
| <td>Seeds the random number generators in MXNet.</td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="section" id="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.symbol.random"></span><p>Random distribution generator Symbol API of MXNet.</p> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.uniform"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">uniform</code><span class="sig-paren">(</span><em>low=0</em>, <em>high=1</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#uniform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.uniform" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Draw random samples from a uniform distribution.</p> |
| <p>Samples are uniformly distributed over the half-open interval <em>[low, high)</em> |
| (includes <em>low</em>, but excludes <em>high</em>).</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>low</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Lower boundary of the output interval. All values generated will be |
| greater than or equal to low. The default value is 0.</li> |
| <li><strong>high</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Upper boundary of the output interval. All values generated will be |
| less than high. The default value is 1.0.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw. If shape is, e.g., <cite>(m, n)</cite> and <cite>low</cite> and |
| <cite>high</cite> are scalars, output shape will be <cite>(m, n)</cite>. If <cite>low</cite> and <cite>high</cite> |
| are Symbols with shape, e.g., <cite>(x, y)</cite>, then output will have shape |
| <cite>(x, y, m, n)</cite>, where <cite>m*n</cite> samples are drawn for each <cite>[low, high)</cite> pair.</li> |
| <li><strong>dtype</strong> (<em>{'float16'</em><em>,</em><em>'float32'</em><em>, </em><em>'float64'}</em>) – Data type of output samples. Default is ‘float32’</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.normal"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">normal</code><span class="sig-paren">(</span><em>loc=0</em>, <em>scale=1</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#normal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.normal" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Draw random samples from a normal (Gaussian) distribution.</p> |
| <p>Samples are distributed according to a normal distribution parametrized |
| by <em>loc</em> (mean) and <em>scale</em> (standard deviation).</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>loc</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Mean (centre) of the distribution.</li> |
| <li><strong>scale</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Standard deviation (spread or width) of the distribution.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw. If shape is, e.g., <cite>(m, n)</cite> and <cite>loc</cite> and |
| <cite>scale</cite> are scalars, output shape will be <cite>(m, n)</cite>. If <cite>loc</cite> and <cite>scale</cite> |
| are Symbols with shape, e.g., <cite>(x, y)</cite>, then output will have shape |
| <cite>(x, y, m, n)</cite>, where <cite>m*n</cite> samples are drawn for each <cite>[loc, scale)</cite> pair.</li> |
| <li><strong>dtype</strong> (<em>{'float16'</em><em>,</em><em>'float32'</em><em>, </em><em>'float64'}</em>) – Data type of output samples. Default is ‘float32’</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.poisson"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">poisson</code><span class="sig-paren">(</span><em>lam=1</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#poisson"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.poisson" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Draw random samples from a Poisson distribution.</p> |
| <p>Samples are distributed according to a Poisson distribution parametrized |
| by <em>lambda</em> (rate). Samples will always be returned as a floating point data type.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>lam</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Expectation of interval, should be >= 0.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw. If shape is, e.g., <cite>(m, n)</cite> and <cite>lam</cite> is |
| a scalar, output shape will be <cite>(m, n)</cite>. If <cite>lam</cite> |
| is an Symbol with shape, e.g., <cite>(x, y)</cite>, then output will have shape |
| <cite>(x, y, m, n)</cite>, where <cite>m*n</cite> samples are drawn for each entry in <cite>lam</cite>.</li> |
| <li><strong>dtype</strong> (<em>{'float16'</em><em>,</em><em>'float32'</em><em>, </em><em>'float64'}</em>) – Data type of output samples. Default is ‘float32’</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.exponential"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">exponential</code><span class="sig-paren">(</span><em>scale=1</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#exponential"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.exponential" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Draw samples from an exponential distribution.</p> |
| <p>Its probability density function is</p> |
| <div class="math"> |
| \[f(x; \frac{1}{\beta}) = \frac{1}{\beta} \exp(-\frac{x}{\beta}),\]</div> |
| <p>for x > 0 and 0 elsewhere. beta is the scale parameter, which is the |
| inverse of the rate parameter lambda = 1/beta.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>scale</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – The scale parameter, beta = 1/lambda.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw. If shape is, e.g., <cite>(m, n)</cite> and <cite>scale</cite> is |
| a scalar, output shape will be <cite>(m, n)</cite>. If <cite>scale</cite> |
| is an Symbol with shape, e.g., <cite>(x, y)</cite>, then output will have shape |
| <cite>(x, y, m, n)</cite>, where <cite>m*n</cite> samples are drawn for each entry in <cite>scale</cite>.</li> |
| <li><strong>dtype</strong> (<em>{'float16'</em><em>,</em><em>'float32'</em><em>, </em><em>'float64'}</em>) – Data type of output samples. Default is ‘float32’</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.gamma"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">gamma</code><span class="sig-paren">(</span><em>alpha=1</em>, <em>beta=1</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#gamma"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.gamma" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Draw random samples from a gamma distribution.</p> |
| <p>Samples are distributed according to a gamma distribution parametrized |
| by <em>alpha</em> (shape) and <em>beta</em> (scale).</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>alpha</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – The shape of the gamma distribution. Should be greater than zero.</li> |
| <li><strong>beta</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – The scale of the gamma distribution. Should be greater than zero. |
| Default is equal to 1.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw. If shape is, e.g., <cite>(m, n)</cite> and <cite>alpha</cite> and |
| <cite>beta</cite> are scalars, output shape will be <cite>(m, n)</cite>. If <cite>alpha</cite> and <cite>beta</cite> |
| are Symbols with shape, e.g., <cite>(x, y)</cite>, then output will have shape |
| <cite>(x, y, m, n)</cite>, where <cite>m*n</cite> samples are drawn for each <cite>[alpha, beta)</cite> pair.</li> |
| <li><strong>dtype</strong> (<em>{'float16'</em><em>,</em><em>'float32'</em><em>, </em><em>'float64'}</em>) – Data type of output samples. Default is ‘float32’</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.negative_binomial"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">negative_binomial</code><span class="sig-paren">(</span><em>k=1</em>, <em>p=1</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#negative_binomial"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.negative_binomial" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Draw random samples from a negative binomial distribution.</p> |
| <p>Samples are distributed according to a negative binomial distribution |
| parametrized by <em>k</em> (limit of unsuccessful experiments) and <em>p</em> (failure |
| probability in each experiment). Samples will always be returned as a |
| floating point data type.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>k</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Limit of unsuccessful experiments, > 0.</li> |
| <li><strong>p</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Failure probability in each experiment, >= 0 and <=1.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw. If shape is, e.g., <cite>(m, n)</cite> and <cite>k</cite> and |
| <cite>p</cite> are scalars, output shape will be <cite>(m, n)</cite>. If <cite>k</cite> and <cite>p</cite> |
| are Symbols with shape, e.g., <cite>(x, y)</cite>, then output will have shape |
| <cite>(x, y, m, n)</cite>, where <cite>m*n</cite> samples are drawn for each <cite>[k, p)</cite> pair.</li> |
| <li><strong>dtype</strong> (<em>{'float16'</em><em>,</em><em>'float32'</em><em>, </em><em>'float64'}</em>) – Data type of output samples. Default is ‘float32’</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.generalized_negative_binomial"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">generalized_negative_binomial</code><span class="sig-paren">(</span><em>mu=1</em>, <em>alpha=1</em>, <em>shape=_Null</em>, <em>dtype=_Null</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#generalized_negative_binomial"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.generalized_negative_binomial" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Draw random samples from a generalized negative binomial distribution.</p> |
| <p>Samples are distributed according to a generalized negative binomial |
| distribution parametrized by <em>mu</em> (mean) and <em>alpha</em> (dispersion). |
| <em>alpha</em> is defined as <em>1/k</em> where <em>k</em> is the failure limit of the |
| number of unsuccessful experiments (generalized to real numbers). |
| Samples will always be returned as a floating point data type.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>mu</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Mean of the negative binomial distribution.</li> |
| <li><strong>alpha</strong> (<em>float</em><em> or </em><a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – Alpha (dispersion) parameter of the negative binomial distribution.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw. If shape is, e.g., <cite>(m, n)</cite> and <cite>mu</cite> and |
| <cite>alpha</cite> are scalars, output shape will be <cite>(m, n)</cite>. If <cite>mu</cite> and <cite>alpha</cite> |
| are Symbols with shape, e.g., <cite>(x, y)</cite>, then output will have shape |
| <cite>(x, y, m, n)</cite>, where <cite>m*n</cite> samples are drawn for each <cite>[mu, alpha)</cite> pair.</li> |
| <li><strong>dtype</strong> (<em>{'float16'</em><em>,</em><em>'float32'</em><em>, </em><em>'float64'}</em>) – Data type of output samples. Default is ‘float32’</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.multinomial"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">multinomial</code><span class="sig-paren">(</span><em>data</em>, <em>shape=_Null</em>, <em>get_prob=True</em>, <em>dtype='int32'</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#multinomial"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.multinomial" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Concurrent sampling from multiple multinomial distributions.</p> |
| <div class="admonition note"> |
| <p class="first admonition-title">Note</p> |
| <p class="last">The input distribution must be normalized, i.e. <cite>data</cite> must sum to |
| 1 along its last dimension.</p> |
| </div> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>data</strong> (<a class="reference internal" href="symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a>) – An <em>n</em> dimensional array whose last dimension has length <cite>k</cite>, where |
| <cite>k</cite> is the number of possible outcomes of each multinomial distribution. |
| For example, data with shape <cite>(m, n, k)</cite> specifies <cite>m*n</cite> multinomial |
| distributions each with <cite>k</cite> possible outcomes.</li> |
| <li><strong>shape</strong> (<em>int</em><em> or </em><em>tuple of ints</em>) – The number of samples to draw from each distribution. If shape is empty |
| one sample will be drawn from each distribution.</li> |
| <li><strong>get_prob</strong> (<em>bool</em>) – If true, a second array containing log likelihood of the drawn |
| samples will also be returned. |
| This is usually used for reinforcement learning, where you can provide |
| reward as head gradient w.r.t. this array to estimate gradient.</li> |
| <li><strong>dtype</strong> (<em>str</em><em> or </em><em>numpy.dtype</em>) – Data type of the sample output array. The default is int32. |
| Note that the data type of the log likelihood array is the same with that of <cite>data</cite>.</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </dd></dl> |
| <dl class="function"> |
| <dt id="mxnet.symbol.random.shuffle"> |
| <code class="descclassname">mxnet.symbol.random.</code><code class="descname">shuffle</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/symbol/random.html#shuffle"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.symbol.random.shuffle" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Shuffle the elements randomly.</p> |
| <p>This shuffles the array along the first axis. |
| The order of the elements in each subarray does not change. |
| For example, if a 2D array is given, the order of the rows randomly changes, |
| but the order of the elements in each row does not change.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<a class="reference internal" href="../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – Input data array.</td> |
| </tr> |
| </tbody> |
| </table> |
| <p class="rubric">Examples</p> |
| <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">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="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">],</span> <span class="p">[</span><span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">],</span> <span class="p">[</span><span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">]])</span> |
| <span class="gp">>>> </span><span class="n">a</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">sym</span><span class="o">.</span><span class="n">Variable</span><span class="p">(</span><span class="s1">'a'</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="n">b</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">sym</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">shuffle</span><span class="p">(</span><span class="n">a</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="n">b</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="n">data</span><span class="p">)</span> |
| <span class="go">[[ 0. 1. 2.]</span> |
| <span class="go"> [ 6. 7. 8.]</span> |
| <span class="go"> [ 3. 4. 5.]]</span> |
| <span class="go"><NDArray 2x3 @cpu(0)></span> |
| <span class="gp">>>> </span><span class="n">b</span><span class="o">.</span><span class="n">eval</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="n">data</span><span class="p">)</span> |
| <span class="go">[[ 3. 4. 5.]</span> |
| <span class="go"> [ 0. 1. 2.]</span> |
| <span class="go"> [ 6. 7. 8.]]</span> |
| <span class="go"><NDArray 2x3 @cpu(0)></span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| <span class="target" id="module-mxnet.random"></span><p>Random number interface of MXNet.</p> |
| <dl class="function"> |
| <dt id="mxnet.random.seed"> |
| <code class="descclassname">mxnet.random.</code><code class="descname">seed</code><span class="sig-paren">(</span><em>seed_state</em>, <em>ctx='all'</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/random.html#seed"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.random.seed" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Seeds the random number generators in MXNet.</p> |
| <p>This affects the behavior of modules in MXNet that uses random number generators, |
| like the dropout operator and <cite>NDArray</cite>‘s random sampling operators.</p> |
| <table class="docutils field-list" frame="void" rules="none"> |
| <col class="field-name"/> |
| <col class="field-body"/> |
| <tbody valign="top"> |
| <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple"> |
| <li><strong>seed_state</strong> (<em>int</em>) – The random number seed.</li> |
| <li><strong>ctx</strong> (<em>Context</em>) – The device context of the generator. The default is “all” which means seeding random |
| number generators of all devices.</li> |
| </ul> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| <p class="rubric">Notes</p> |
| <p>Random number generators in MXNet are device specific. |
| <cite>mx.random.seed(seed_state)</cite> sets the state of each generator using <cite>seed_state</cite> and the |
| device id. Therefore, random numbers generated from different devices can be different |
| even if they are seeded using the same seed.</p> |
| <p>To produce identical random number sequences independent of the device id, |
| set optional <cite>ctx</cite> argument. This produces the same sequence of random numbers independent |
| of the device id, but the sequence can be different on different kind of devices as MXNet’s |
| random number generators for CPU and GPU use different algorithms.</p> |
| <p class="rubric">Example</p> |
| <div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 1.36481571 -0.62203991]</span> |
| <span class="go"> [-1.4962182 -0.08511394]]</span> |
| <span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 1.09544981 -0.20014545]</span> |
| <span class="go"> [-0.20808885 0.2527658 ]]</span> |
| <span class="go"># Same results on the same device with the same seed</span> |
| <span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 0.47400656 -0.75213492]</span> |
| <span class="go"> [ 0.20251541 0.95352972]]</span> |
| <span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 0.47400656 -0.75213492]</span> |
| <span class="go"> [ 0.20251541 0.95352972]]</span> |
| <span class="go"># Different results on gpu(0) and gpu(1) with the same seed</span> |
| <span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="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><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 2.5020072 -1.6884501]</span> |
| <span class="go"> [-0.7931333 -1.4218881]]</span> |
| <span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="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">1</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 0.24336822 -1.664805 ]</span> |
| <span class="go"> [-1.0223296 1.253198 ]]</span> |
| <span class="go"># Seeding with `ctx` argument produces identical results on gpu(0) and gpu(1)</span> |
| <span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="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> |
| <span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="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><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 2.5020072 -1.6884501]</span> |
| <span class="go"> [-0.7931333 -1.4218881]]</span> |
| <span class="gp">>>> </span><span class="n">mx</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="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">1</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="nb">print</span><span class="p">(</span><span class="n">mx</span><span class="o">.</span><span class="n">nd</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span><span class="mi">2</span><span class="p">),</span> <span class="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">1</span><span class="p">))</span><span class="o">.</span><span class="n">asnumpy</span><span class="p">())</span> |
| <span class="go">[[ 2.5020072 -1.6884501]</span> |
| <span class="go"> [-0.7931333 -1.4218881]]</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| <script>auto_index("api-reference");</script></div> |
| </div> |
| </div> |
| </div> |
| <div aria-label="main navigation" class="sphinxsidebar rightsidebar" role="navigation"> |
| <div class="sphinxsidebarwrapper"> |
| <h3><a href="../../../index.html">Table Of Contents</a></h3> |
| <ul> |
| <li><a class="reference internal" href="#">Random Distribution Generator Symbol API</a><ul> |
| <li><a class="reference internal" href="#overview">Overview</a></li> |
| <li><a class="reference internal" href="#random-distribution-generator">Random Distribution Generator</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> |