| <!DOCTYPE html> |
| |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta charset="utf-8" /> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
| <meta http-equiv="x-ua-compatible" content="ie=edge"> |
| <style> |
| .dropdown { |
| position: relative; |
| display: inline-block; |
| } |
| |
| .dropdown-content { |
| display: none; |
| position: absolute; |
| background-color: #f9f9f9; |
| min-width: 160px; |
| box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); |
| padding: 12px 16px; |
| z-index: 1; |
| text-align: left; |
| } |
| |
| .dropdown:hover .dropdown-content { |
| display: block; |
| } |
| |
| .dropdown-option:hover { |
| color: #FF4500; |
| } |
| |
| .dropdown-option-active { |
| color: #FF4500; |
| font-weight: lighter; |
| } |
| |
| .dropdown-option { |
| color: #000000; |
| font-weight: lighter; |
| } |
| |
| .dropdown-header { |
| color: #FFFFFF; |
| display: inline-flex; |
| } |
| |
| .dropdown-caret { |
| width: 18px; |
| } |
| |
| .dropdown-caret-path { |
| fill: #FFFFFF; |
| } |
| </style> |
| |
| <title>gluon.rnn — Apache MXNet documentation</title> |
| |
| <link rel="stylesheet" href="../../../_static/basic.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" type="text/css" href="../../../_static/mxnet.css" /> |
| <link rel="stylesheet" href="../../../_static/material-design-lite-1.3.0/material.blue-deep_orange.min.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../_static/sphinx_materialdesign_theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../_static/fontawesome/all.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../_static/fonts.css" type="text/css" /> |
| <link rel="stylesheet" href="../../../_static/feedback.css" type="text/css" /> |
| <script id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script> |
| <script src="../../../_static/jquery.js"></script> |
| <script src="../../../_static/underscore.js"></script> |
| <script src="../../../_static/doctools.js"></script> |
| <script src="../../../_static/language_data.js"></script> |
| <script src="../../../_static/google_analytics.js"></script> |
| <script src="../../../_static/autodoc.js"></script> |
| <script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script> |
| <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-AMS-MML_HTMLorMML"></script> |
| <script type="text/x-mathjax-config">MathJax.Hub.Config({"tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "processEscapes": true, "ignoreClass": "document", "processClass": "math|output_area"}})</script> |
| <link rel="shortcut icon" href="../../../_static/mxnet-icon.png"/> |
| <link rel="index" title="Index" href="../../../genindex.html" /> |
| <link rel="search" title="Search" href="../../../search.html" /> |
| <link rel="next" title="gluon.utils" href="../utils/index.html" /> |
| <link rel="prev" title="gluon.nn" href="../nn/index.html" /> |
| </head> |
| <body><header class="site-header" role="banner"> |
| <div class="wrapper"> |
| <a class="site-title" rel="author" href="/versions/1.8.0/"><img |
| src="../../../_static/mxnet_logo.png" class="site-header-logo"></a> |
| <nav class="site-nav"> |
| <input type="checkbox" id="nav-trigger" class="nav-trigger"/> |
| <label for="nav-trigger"> |
| <span class="menu-icon"> |
| <svg viewBox="0 0 18 15" width="18px" height="15px"> |
| <path d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.032C17.335,0,18,0.665,18,1.484L18,1.484z M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.032C17.335,6.031,18,6.696,18,7.516L18,7.516z M18,13.516C18,14.335,17.335,15,16.516,15H1.484 C0.665,15,0,14.335,0,13.516l0,0c0-0.82,0.665-1.483,1.484-1.483h15.032C17.335,12.031,18,12.695,18,13.516L18,13.516z"/> |
| </svg> |
| </span> |
| </label> |
| |
| <div class="trigger"> |
| <a class="page-link" href="/versions/1.8.0/get_started">Get Started</a> |
| <a class="page-link" href="/versions/1.8.0/blog">Blog</a> |
| <a class="page-link" href="/versions/1.8.0/features">Features</a> |
| <a class="page-link" href="/versions/1.8.0/ecosystem">Ecosystem</a> |
| <a class="page-link page-current" href="/versions/1.8.0/api">Docs & Tutorials</a> |
| <a class="page-link" href="https://github.com/apache/incubator-mxnet">GitHub</a> |
| <div class="dropdown"> |
| <span class="dropdown-header">1.8.0 |
| <svg class="dropdown-caret" viewBox="0 0 32 32" class="icon icon-caret-bottom" aria-hidden="true"><path class="dropdown-caret-path" d="M24 11.305l-7.997 11.39L8 11.305z"></path></svg> |
| </span> |
| <div class="dropdown-content"> |
| <a class="dropdown-option" href="/">master</a><br> |
| <a class="dropdown-option-active" href="/versions/1.8.0/">1.8.0</a><br> |
| <a class="dropdown-option" href="/versions/1.7.0/">1.7.0</a><br> |
| <a class="dropdown-option" href="/versions/1.6.0/">1.6.0</a><br> |
| <a class="dropdown-option" href="/versions/1.5.0/">1.5.0</a><br> |
| <a class="dropdown-option" href="/versions/1.4.1/">1.4.1</a><br> |
| <a class="dropdown-option" href="/versions/1.3.1/">1.3.1</a><br> |
| <a class="dropdown-option" href="/versions/1.2.1/">1.2.1</a><br> |
| <a class="dropdown-option" href="/versions/1.1.0/">1.1.0</a><br> |
| <a class="dropdown-option" href="/versions/1.0.0/">1.0.0</a><br> |
| <a class="dropdown-option" href="/versions/0.12.1/">0.12.1</a><br> |
| <a class="dropdown-option" href="/versions/0.11.0/">0.11.0</a> |
| </div> |
| </div> |
| </div> |
| </nav> |
| </div> |
| </header> |
| <div class="mdl-layout mdl-js-layout mdl-layout--fixed-header mdl-layout--fixed-drawer"><header class="mdl-layout__header mdl-layout__header--waterfall "> |
| <div class="mdl-layout__header-row"> |
| |
| <nav class="mdl-navigation breadcrumb"> |
| <a class="mdl-navigation__link" href="../../index.html">Python API</a><i class="material-icons">navigate_next</i> |
| <a class="mdl-navigation__link" href="../index.html">mxnet.gluon</a><i class="material-icons">navigate_next</i> |
| <a class="mdl-navigation__link is-active">gluon.rnn</a> |
| </nav> |
| <div class="mdl-layout-spacer"></div> |
| <nav class="mdl-navigation"> |
| |
| <form class="form-inline pull-sm-right" action="../../../search.html" method="get"> |
| <div class="mdl-textfield mdl-js-textfield mdl-textfield--expandable mdl-textfield--floating-label mdl-textfield--align-right"> |
| <label id="quick-search-icon" class="mdl-button mdl-js-button mdl-button--icon" for="waterfall-exp"> |
| <i class="material-icons">search</i> |
| </label> |
| <div class="mdl-textfield__expandable-holder"> |
| <input class="mdl-textfield__input" type="text" name="q" id="waterfall-exp" placeholder="Search" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </div> |
| </div> |
| <div class="mdl-tooltip" data-mdl-for="quick-search-icon"> |
| Quick search |
| </div> |
| </form> |
| |
| <a id="button-show-source" |
| class="mdl-button mdl-js-button mdl-button--icon" |
| href="../../../_sources/api/gluon/rnn/index.rst" rel="nofollow"> |
| <i class="material-icons">code</i> |
| </a> |
| <div class="mdl-tooltip" data-mdl-for="button-show-source"> |
| Show Source |
| </div> |
| </nav> |
| </div> |
| <div class="mdl-layout__header-row header-links"> |
| <div class="mdl-layout-spacer"></div> |
| <nav class="mdl-navigation"> |
| </nav> |
| </div> |
| </header><header class="mdl-layout__drawer"> |
| |
| <div class="globaltoc"> |
| <span class="mdl-layout-title toc">Table Of Contents</span> |
| |
| |
| |
| <nav class="mdl-navigation"> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../../tutorials/index.html">Python Tutorials</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/getting-started/index.html">Getting Started</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/index.html">Crash Course</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/1-ndarray.html">Manipulate data with <code class="docutils literal notranslate"><span class="pre">ndarray</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/2-nn.html">Create a neural network</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/3-autograd.html">Automatic differentiation with <code class="docutils literal notranslate"><span class="pre">autograd</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/4-train.html">Train the neural network</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/5-predict.html">Predict with a pre-trained model</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/6-use_gpus.html">Use GPUs</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/to-mxnet/index.html">Moving to MXNet from Other Frameworks</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/to-mxnet/pytorch.html">PyTorch vs Apache MXNet</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/gluon_from_experiment_to_deployment.html">Gluon: from experiment to deployment</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/logistic_regression_explained.html">Logistic regression explained</a></li> |
| <li class="toctree-l3"><a class="reference external" href="https://mxnet.apache.org/api/python/docs/tutorials/packages/gluon/image/mnist.html">MNIST</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/packages/index.html">Packages</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/autograd/index.html">Automatic Differentiation</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/gluon/index.html">Gluon</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/index.html">Blocks</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/custom-layer.html">Custom Layers</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/custom_layer_beginners.html">Customer Layers (Beginners)</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/hybridize.html">Hybridize</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/init.html">Initialization</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/naming.html">Parameter and Block Naming</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/nn.html">Layers and Blocks</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/parameters.html">Parameter Management</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/save_load_params.html">Saving and Loading Gluon Models</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/activations/activations.html">Activation Blocks</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/data/index.html">Data Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html">Image Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html#Spatial-Augmentation">Spatial Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html#Color-Augmentation">Color Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html#Composed-Augmentations">Composed Augmentations</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html">Gluon <code class="docutils literal notranslate"><span class="pre">Dataset</span></code>s and <code class="docutils literal notranslate"><span class="pre">DataLoader</span></code></a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html#Using-own-data-with-included-Datasets">Using own data with included <code class="docutils literal notranslate"><span class="pre">Dataset</span></code>s</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html#Using-own-data-with-custom-Datasets">Using own data with custom <code class="docutils literal notranslate"><span class="pre">Dataset</span></code>s</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html#Appendix:-Upgrading-from-Module-DataIter-to-Gluon-DataLoader">Appendix: Upgrading from Module <code class="docutils literal notranslate"><span class="pre">DataIter</span></code> to Gluon <code class="docutils literal notranslate"><span class="pre">DataLoader</span></code></a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/image/index.html">Image Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/image-augmentation.html">Image Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/info_gan.html">Image similarity search with InfoGAN</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/mnist.html">Handwritten Digit Recognition</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/pretrained_models.html">Using pre-trained models in MXNet</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/index.html">Losses</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/custom-loss.html">Custom Loss Blocks</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/kl_divergence.html">Kullback-Leibler (KL) Divergence</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/loss.html">Loss functions</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/text/index.html">Text Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/text/gnmt.html">Google Neural Machine Translation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/text/transformer.html">Machine Translation with Transformer</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/training/index.html">Training</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/fit_api_tutorial.html">MXNet Gluon Fit API</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/trainer.html">Trainer</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/index.html">Learning Rates</a><ul> |
| <li class="toctree-l6"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/learning_rate_finder.html">Learning Rate Finder</a></li> |
| <li class="toctree-l6"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/learning_rate_schedules.html">Learning Rate Schedules</a></li> |
| <li class="toctree-l6"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/learning_rate_schedules_advanced.html">Advanced Learning Rate Schedules</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/normalization/index.html">Normalization Blocks</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/kvstore/index.html">KVStore</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/kvstore/kvstore.html">Distributed Key-Value Store</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/ndarray/index.html">NDArray</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/01-ndarray-intro.html">An Intro: Manipulate Data the MXNet Way with NDArray</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/02-ndarray-operations.html">NDArray Operations</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/03-ndarray-contexts.html">NDArray Contexts</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/gotchas_numpy_in_mxnet.html">Gotchas using NumPy in Apache MXNet</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/index.html">Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/csr.html">CSRNDArray - NDArray in Compressed Sparse Row Storage Format</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/row_sparse.html">RowSparseNDArray - NDArray for Sparse Gradient Updates</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/train.html">Train a Linear Regression Model with Sparse Symbols</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/train_gluon.html">Sparse NDArrays with Gluon</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/onnx/index.html">ONNX</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/onnx/fine_tuning_gluon.html">Fine-tuning an ONNX model</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/onnx/inference_on_onnx_model.html">Running inference on MXNet/Gluon from an ONNX model</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/onnx/super_resolution.html">Importing an ONNX model into MXNet</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/python/docs/tutorials/deploy/export/onnx.html">Export ONNX Models</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/optimizer/index.html">Optimizers</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/viz/index.html">Visualization</a><ul> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/faq/visualize_graph">Visualize networks</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/performance/index.html">Performance</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/performance/compression/index.html">Compression</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/compression/int8.html">Deploy with int-8</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/faq/float16">Float16</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/faq/gradient_compression">Gradient Compression</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://gluon-cv.mxnet.io/build/examples_deployment/int8_inference.html">GluonCV with Quantized Models</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/performance/backend/index.html">Accelerated Backend Tools</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/mkldnn/index.html">Intel MKL-DNN</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/performance/backend/mkldnn/mkldnn_quantization.html">Quantize with MKL-DNN backend</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/performance/backend/mkldnn/mkldnn_readme.html">Install MXNet with MKL-DNN</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/tensorrt/index.html">TensorRT</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/performance/backend/tensorrt/tensorrt.html">Optimizing Deep Learning Computation Graphs with TensorRT</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/tvm.html">Use TVM</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/profiler.html">Profiling MXNet Models</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/amp.html">Using AMP: Automatic Mixed Precision</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/deploy/index.html">Deployment</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/deploy/export/index.html">Export</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/export/onnx.html">Exporting to ONNX format</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://gluon-cv.mxnet.io/build/examples_deployment/export_network.html">Export Gluon CV Models</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/python/docs/tutorials/packages/gluon/blocks/save_load_params.html">Save / Load Parameters</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/deploy/inference/index.html">Inference</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/cpp.html">Deploy into C++</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/image_classification_jetson.html">Image Classication using pretrained ResNet-50 model on Jetson module</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/scala.html">Deploy into a Java or Scala Environment</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/wine_detector.html">Real-time Object Detection with MXNet On The Raspberry Pi</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/index.html">Run on AWS</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/use_ec2.html">Run on an EC2 Instance</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/use_sagemaker.html">Run on Amazon SageMaker</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/cloud.html">MXNet on the Cloud</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/extend/index.html">Extend</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/extend/custom_layer.html">Custom Layers</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/extend/customop.html">Custom Numpy Operators</a></li> |
| <li class="toctree-l3"><a class="reference external" href="https://mxnet.apache.org/api/faq/new_op">New Operator Creation</a></li> |
| <li class="toctree-l3"><a class="reference external" href="https://mxnet.apache.org/api/faq/add_op_in_backend">New Operator in MXNet Backend</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Python API</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../../ndarray/index.html">mxnet.ndarray</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/ndarray.html">ndarray</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/contrib/index.html">ndarray.contrib</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/image/index.html">ndarray.image</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/linalg/index.html">ndarray.linalg</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/op/index.html">ndarray.op</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/random/index.html">ndarray.random</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/register/index.html">ndarray.register</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/sparse/index.html">ndarray.sparse</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/utils/index.html">ndarray.utils</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2 current"><a class="reference internal" href="../index.html">mxnet.gluon</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../block.html">gluon.Block</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hybrid_block.html">gluon.HybridBlock</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../symbol_block.html">gluon.SymbolBlock</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../constant.html">gluon.Constant</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../parameter.html">gluon.Parameter</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../parameter_dict.html">gluon.ParameterDict</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../trainer.html">gluon.Trainer</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../contrib/index.html">gluon.contrib</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../data/index.html">gluon.data</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../data/vision/index.html">data.vision</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../data/vision/datasets/index.html">vision.datasets</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../data/vision/transforms/index.html">vision.transforms</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../loss/index.html">gluon.loss</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../model_zoo/index.html">gluon.model_zoo.vision</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nn/index.html">gluon.nn</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">gluon.rnn</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../utils/index.html">gluon.utils</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../autograd/index.html">mxnet.autograd</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../initializer/index.html">mxnet.initializer</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../optimizer/index.html">mxnet.optimizer</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../lr_scheduler/index.html">mxnet.lr_scheduler</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../metric/index.html">mxnet.metric</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../kvstore/index.html">mxnet.kvstore</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../symbol/index.html">mxnet.symbol</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/symbol.html">symbol</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/contrib/index.html">symbol.contrib</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/image/index.html">symbol.image</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/linalg/index.html">symbol.linalg</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/op/index.html">symbol.op</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/random/index.html">symbol.random</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/register/index.html">symbol.register</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/sparse/index.html">symbol.sparse</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../module/index.html">mxnet.module</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../contrib/index.html">mxnet.contrib</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/autograd/index.html">contrib.autograd</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/io/index.html">contrib.io</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/ndarray/index.html">contrib.ndarray</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/onnx/index.html">contrib.onnx</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/quantization/index.html">contrib.quantization</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/symbol/index.html">contrib.symbol</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/tensorboard/index.html">contrib.tensorboard</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/tensorrt/index.html">contrib.tensorrt</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/text/index.html">contrib.text</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../mxnet/index.html">mxnet</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/attribute/index.html">mxnet.attribute</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/base/index.html">mxnet.base</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/callback/index.html">mxnet.callback</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/context/index.html">mxnet.context</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/engine/index.html">mxnet.engine</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/executor/index.html">mxnet.executor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/executor_manager/index.html">mxnet.executor_manager</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/image/index.html">mxnet.image</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/io/index.html">mxnet.io</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/kvstore_server/index.html">mxnet.kvstore_server</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/libinfo/index.html">mxnet.libinfo</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/log/index.html">mxnet.log</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/model/index.html">mxnet.model</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/monitor/index.html">mxnet.monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/name/index.html">mxnet.name</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/notebook/index.html">mxnet.notebook</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/operator/index.html">mxnet.operator</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/profiler/index.html">mxnet.profiler</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/random/index.html">mxnet.random</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/recordio/index.html">mxnet.recordio</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/registry/index.html">mxnet.registry</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/rtc/index.html">mxnet.rtc</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/runtime/index.html">mxnet.runtime</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/test_utils/index.html">mxnet.test_utils</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/torch/index.html">mxnet.torch</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/util/index.html">mxnet.util</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/visualization/index.html">mxnet.visualization</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| |
| </nav> |
| |
| </div> |
| |
| </header> |
| <main class="mdl-layout__content" tabIndex="0"> |
| |
| <script type="text/javascript" src="../../../_static/sphinx_materialdesign_theme.js "></script> |
| <script type="text/javascript" src="../../../_static/feedback.js"></script> |
| <header class="mdl-layout__drawer"> |
| |
| <div class="globaltoc"> |
| <span class="mdl-layout-title toc">Table Of Contents</span> |
| |
| |
| |
| <nav class="mdl-navigation"> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../../../tutorials/index.html">Python Tutorials</a><ul> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/getting-started/index.html">Getting Started</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/index.html">Crash Course</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/1-ndarray.html">Manipulate data with <code class="docutils literal notranslate"><span class="pre">ndarray</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/2-nn.html">Create a neural network</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/3-autograd.html">Automatic differentiation with <code class="docutils literal notranslate"><span class="pre">autograd</span></code></a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/4-train.html">Train the neural network</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/5-predict.html">Predict with a pre-trained model</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/crash-course/6-use_gpus.html">Use GPUs</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/to-mxnet/index.html">Moving to MXNet from Other Frameworks</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/getting-started/to-mxnet/pytorch.html">PyTorch vs Apache MXNet</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/gluon_from_experiment_to_deployment.html">Gluon: from experiment to deployment</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/getting-started/logistic_regression_explained.html">Logistic regression explained</a></li> |
| <li class="toctree-l3"><a class="reference external" href="https://mxnet.apache.org/api/python/docs/tutorials/packages/gluon/image/mnist.html">MNIST</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/packages/index.html">Packages</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/autograd/index.html">Automatic Differentiation</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/gluon/index.html">Gluon</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/index.html">Blocks</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/custom-layer.html">Custom Layers</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/custom_layer_beginners.html">Customer Layers (Beginners)</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/hybridize.html">Hybridize</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/init.html">Initialization</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/naming.html">Parameter and Block Naming</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/nn.html">Layers and Blocks</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/parameters.html">Parameter Management</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/save_load_params.html">Saving and Loading Gluon Models</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/blocks/activations/activations.html">Activation Blocks</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/data/index.html">Data Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html">Image Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html#Spatial-Augmentation">Spatial Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html#Color-Augmentation">Color Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/data_augmentation.html#Composed-Augmentations">Composed Augmentations</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html">Gluon <code class="docutils literal notranslate"><span class="pre">Dataset</span></code>s and <code class="docutils literal notranslate"><span class="pre">DataLoader</span></code></a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html#Using-own-data-with-included-Datasets">Using own data with included <code class="docutils literal notranslate"><span class="pre">Dataset</span></code>s</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html#Using-own-data-with-custom-Datasets">Using own data with custom <code class="docutils literal notranslate"><span class="pre">Dataset</span></code>s</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/data/datasets.html#Appendix:-Upgrading-from-Module-DataIter-to-Gluon-DataLoader">Appendix: Upgrading from Module <code class="docutils literal notranslate"><span class="pre">DataIter</span></code> to Gluon <code class="docutils literal notranslate"><span class="pre">DataLoader</span></code></a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/image/index.html">Image Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/image-augmentation.html">Image Augmentation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/info_gan.html">Image similarity search with InfoGAN</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/mnist.html">Handwritten Digit Recognition</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/image/pretrained_models.html">Using pre-trained models in MXNet</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/index.html">Losses</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/custom-loss.html">Custom Loss Blocks</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/kl_divergence.html">Kullback-Leibler (KL) Divergence</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/loss/loss.html">Loss functions</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/text/index.html">Text Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/text/gnmt.html">Google Neural Machine Translation</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/text/transformer.html">Machine Translation with Transformer</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/gluon/training/index.html">Training</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/fit_api_tutorial.html">MXNet Gluon Fit API</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/trainer.html">Trainer</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/index.html">Learning Rates</a><ul> |
| <li class="toctree-l6"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/learning_rate_finder.html">Learning Rate Finder</a></li> |
| <li class="toctree-l6"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/learning_rate_schedules.html">Learning Rate Schedules</a></li> |
| <li class="toctree-l6"><a class="reference internal" href="../../../tutorials/packages/gluon/training/learning_rates/learning_rate_schedules_advanced.html">Advanced Learning Rate Schedules</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/gluon/training/normalization/index.html">Normalization Blocks</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/kvstore/index.html">KVStore</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/kvstore/kvstore.html">Distributed Key-Value Store</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/ndarray/index.html">NDArray</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/01-ndarray-intro.html">An Intro: Manipulate Data the MXNet Way with NDArray</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/02-ndarray-operations.html">NDArray Operations</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/03-ndarray-contexts.html">NDArray Contexts</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/gotchas_numpy_in_mxnet.html">Gotchas using NumPy in Apache MXNet</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/index.html">Tutorials</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/csr.html">CSRNDArray - NDArray in Compressed Sparse Row Storage Format</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/row_sparse.html">RowSparseNDArray - NDArray for Sparse Gradient Updates</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/train.html">Train a Linear Regression Model with Sparse Symbols</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/packages/ndarray/sparse/train_gluon.html">Sparse NDArrays with Gluon</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/onnx/index.html">ONNX</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/onnx/fine_tuning_gluon.html">Fine-tuning an ONNX model</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/onnx/inference_on_onnx_model.html">Running inference on MXNet/Gluon from an ONNX model</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/packages/onnx/super_resolution.html">Importing an ONNX model into MXNet</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/python/docs/tutorials/deploy/export/onnx.html">Export ONNX Models</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/optimizer/index.html">Optimizers</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/packages/viz/index.html">Visualization</a><ul> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/faq/visualize_graph">Visualize networks</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/performance/index.html">Performance</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/performance/compression/index.html">Compression</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/compression/int8.html">Deploy with int-8</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/faq/float16">Float16</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/faq/gradient_compression">Gradient Compression</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://gluon-cv.mxnet.io/build/examples_deployment/int8_inference.html">GluonCV with Quantized Models</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/performance/backend/index.html">Accelerated Backend Tools</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/mkldnn/index.html">Intel MKL-DNN</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/performance/backend/mkldnn/mkldnn_quantization.html">Quantize with MKL-DNN backend</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/performance/backend/mkldnn/mkldnn_readme.html">Install MXNet with MKL-DNN</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/tensorrt/index.html">TensorRT</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../../../tutorials/performance/backend/tensorrt/tensorrt.html">Optimizing Deep Learning Computation Graphs with TensorRT</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/tvm.html">Use TVM</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/profiler.html">Profiling MXNet Models</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/performance/backend/amp.html">Using AMP: Automatic Mixed Precision</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/deploy/index.html">Deployment</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/deploy/export/index.html">Export</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/export/onnx.html">Exporting to ONNX format</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://gluon-cv.mxnet.io/build/examples_deployment/export_network.html">Export Gluon CV Models</a></li> |
| <li class="toctree-l4"><a class="reference external" href="https://mxnet.apache.org/api/python/docs/tutorials/packages/gluon/blocks/save_load_params.html">Save / Load Parameters</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/deploy/inference/index.html">Inference</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/cpp.html">Deploy into C++</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/image_classification_jetson.html">Image Classication using pretrained ResNet-50 model on Jetson module</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/scala.html">Deploy into a Java or Scala Environment</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/inference/wine_detector.html">Real-time Object Detection with MXNet On The Raspberry Pi</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/index.html">Run on AWS</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/use_ec2.html">Run on an EC2 Instance</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/use_sagemaker.html">Run on Amazon SageMaker</a></li> |
| <li class="toctree-l4"><a class="reference internal" href="../../../tutorials/deploy/run-on-aws/cloud.html">MXNet on the Cloud</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../../tutorials/extend/index.html">Extend</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/extend/custom_layer.html">Custom Layers</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../../tutorials/extend/customop.html">Custom Numpy Operators</a></li> |
| <li class="toctree-l3"><a class="reference external" href="https://mxnet.apache.org/api/faq/new_op">New Operator Creation</a></li> |
| <li class="toctree-l3"><a class="reference external" href="https://mxnet.apache.org/api/faq/add_op_in_backend">New Operator in MXNet Backend</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Python API</a><ul class="current"> |
| <li class="toctree-l2"><a class="reference internal" href="../../ndarray/index.html">mxnet.ndarray</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/ndarray.html">ndarray</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/contrib/index.html">ndarray.contrib</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/image/index.html">ndarray.image</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/linalg/index.html">ndarray.linalg</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/op/index.html">ndarray.op</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/random/index.html">ndarray.random</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/register/index.html">ndarray.register</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/sparse/index.html">ndarray.sparse</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../ndarray/utils/index.html">ndarray.utils</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2 current"><a class="reference internal" href="../index.html">mxnet.gluon</a><ul class="current"> |
| <li class="toctree-l3"><a class="reference internal" href="../block.html">gluon.Block</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../hybrid_block.html">gluon.HybridBlock</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../symbol_block.html">gluon.SymbolBlock</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../constant.html">gluon.Constant</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../parameter.html">gluon.Parameter</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../parameter_dict.html">gluon.ParameterDict</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../trainer.html">gluon.Trainer</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../contrib/index.html">gluon.contrib</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../data/index.html">gluon.data</a><ul> |
| <li class="toctree-l4"><a class="reference internal" href="../data/vision/index.html">data.vision</a><ul> |
| <li class="toctree-l5"><a class="reference internal" href="../data/vision/datasets/index.html">vision.datasets</a></li> |
| <li class="toctree-l5"><a class="reference internal" href="../data/vision/transforms/index.html">vision.transforms</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| <li class="toctree-l3"><a class="reference internal" href="../loss/index.html">gluon.loss</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../model_zoo/index.html">gluon.model_zoo.vision</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../nn/index.html">gluon.nn</a></li> |
| <li class="toctree-l3 current"><a class="current reference internal" href="#">gluon.rnn</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../utils/index.html">gluon.utils</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../autograd/index.html">mxnet.autograd</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../initializer/index.html">mxnet.initializer</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../optimizer/index.html">mxnet.optimizer</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../lr_scheduler/index.html">mxnet.lr_scheduler</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../metric/index.html">mxnet.metric</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../kvstore/index.html">mxnet.kvstore</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../symbol/index.html">mxnet.symbol</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/symbol.html">symbol</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/contrib/index.html">symbol.contrib</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/image/index.html">symbol.image</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/linalg/index.html">symbol.linalg</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/op/index.html">symbol.op</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/random/index.html">symbol.random</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/register/index.html">symbol.register</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../symbol/sparse/index.html">symbol.sparse</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../module/index.html">mxnet.module</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="../../contrib/index.html">mxnet.contrib</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/autograd/index.html">contrib.autograd</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/io/index.html">contrib.io</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/ndarray/index.html">contrib.ndarray</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/onnx/index.html">contrib.onnx</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/quantization/index.html">contrib.quantization</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/symbol/index.html">contrib.symbol</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/tensorboard/index.html">contrib.tensorboard</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/tensorrt/index.html">contrib.tensorrt</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../contrib/text/index.html">contrib.text</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="../../mxnet/index.html">mxnet</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/attribute/index.html">mxnet.attribute</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/base/index.html">mxnet.base</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/callback/index.html">mxnet.callback</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/context/index.html">mxnet.context</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/engine/index.html">mxnet.engine</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/executor/index.html">mxnet.executor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/executor_manager/index.html">mxnet.executor_manager</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/image/index.html">mxnet.image</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/io/index.html">mxnet.io</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/kvstore_server/index.html">mxnet.kvstore_server</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/libinfo/index.html">mxnet.libinfo</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/log/index.html">mxnet.log</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/model/index.html">mxnet.model</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/monitor/index.html">mxnet.monitor</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/name/index.html">mxnet.name</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/notebook/index.html">mxnet.notebook</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/operator/index.html">mxnet.operator</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/profiler/index.html">mxnet.profiler</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/random/index.html">mxnet.random</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/recordio/index.html">mxnet.recordio</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/registry/index.html">mxnet.registry</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/rtc/index.html">mxnet.rtc</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/runtime/index.html">mxnet.runtime</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/test_utils/index.html">mxnet.test_utils</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/torch/index.html">mxnet.torch</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/util/index.html">mxnet.util</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="../../mxnet/visualization/index.html">mxnet.visualization</a></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| |
| </nav> |
| |
| </div> |
| |
| </header> |
| |
| <div class="document"> |
| <div class="page-content" role="main"> |
| |
| <div class="section" id="gluon-rnn"> |
| <h1>gluon.rnn<a class="headerlink" href="#gluon-rnn" title="Permalink to this headline">¶</a></h1> |
| <p>Build-in recurrent neural network layers are provided in the following two modules:</p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#module-mxnet.gluon.rnn" title="mxnet.gluon.rnn"><code class="xref py py-obj docutils literal notranslate"><span class="pre">mxnet.gluon.rnn</span></code></a></p></td> |
| <td><p>Recurrent neural network module.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="../contrib/index.html#module-mxnet.gluon.contrib.rnn" title="mxnet.gluon.contrib.rnn"><code class="xref py py-obj docutils literal notranslate"><span class="pre">mxnet.gluon.contrib.rnn</span></code></a></p></td> |
| <td><p>Contrib recurrent neural network module.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <div class="section" id="recurrent-cells"> |
| <h2>Recurrent Cells<a class="headerlink" href="#recurrent-cells" title="Permalink to this headline">¶</a></h2> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.LSTMCell" title="mxnet.gluon.rnn.LSTMCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.LSTMCell</span></code></a></p></td> |
| <td><p>Long-Short Term Memory (LSTM) network cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.GRUCell" title="mxnet.gluon.rnn.GRUCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.GRUCell</span></code></a></p></td> |
| <td><p>Gated Rectified Unit (GRU) network cell.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell" title="mxnet.gluon.rnn.RecurrentCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.RecurrentCell</span></code></a></p></td> |
| <td><p>Abstract base class for RNN cells</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.SequentialRNNCell" title="mxnet.gluon.rnn.SequentialRNNCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.SequentialRNNCell</span></code></a></p></td> |
| <td><p>Sequentially stacking multiple RNN cells.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.BidirectionalCell" title="mxnet.gluon.rnn.BidirectionalCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.BidirectionalCell</span></code></a></p></td> |
| <td><p>Bidirectional RNN cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.DropoutCell" title="mxnet.gluon.rnn.DropoutCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.DropoutCell</span></code></a></p></td> |
| <td><p>Applies dropout on input.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ZoneoutCell" title="mxnet.gluon.rnn.ZoneoutCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.ZoneoutCell</span></code></a></p></td> |
| <td><p>Applies Zoneout on base cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ResidualCell" title="mxnet.gluon.rnn.ResidualCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.ResidualCell</span></code></a></p></td> |
| <td><p>Adds residual connection as described in Wu et al, 2016 (<a class="reference external" href="https://arxiv.org/abs/1609.08144">https://arxiv.org/abs/1609.08144</a>).</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="section" id="recurrent-layers"> |
| <h2>Recurrent Layers<a class="headerlink" href="#recurrent-layers" title="Permalink to this headline">¶</a></h2> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RNN" title="mxnet.gluon.rnn.RNN"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.RNN</span></code></a></p></td> |
| <td><p>Applies a multi-layer Elman RNN with <cite>tanh</cite> or <cite>ReLU</cite> non-linearity to an input sequence.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.LSTM" title="mxnet.gluon.rnn.LSTM"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.LSTM</span></code></a></p></td> |
| <td><p>Applies a multi-layer long short-term memory (LSTM) RNN to an input sequence.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.GRU" title="mxnet.gluon.rnn.GRU"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rnn.GRU</span></code></a></p></td> |
| <td><p>Applies a multi-layer gated recurrent unit (GRU) RNN to an input sequence.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div class="section" id="module-mxnet.gluon.rnn"> |
| <span id="api-reference"></span><h2>API Reference<a class="headerlink" href="#module-mxnet.gluon.rnn" title="Permalink to this headline">¶</a></h2> |
| <p>Recurrent neural network module.</p> |
| <p><strong>Classes</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.BidirectionalCell" title="mxnet.gluon.rnn.BidirectionalCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">BidirectionalCell</span></code></a>(l_cell, r_cell[, …])</p></td> |
| <td><p>Bidirectional RNN cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.DropoutCell" title="mxnet.gluon.rnn.DropoutCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">DropoutCell</span></code></a>(rate[, axes, prefix, params])</p></td> |
| <td><p>Applies dropout on input.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.GRU" title="mxnet.gluon.rnn.GRU"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GRU</span></code></a>(hidden_size[, num_layers, layout, …])</p></td> |
| <td><p>Applies a multi-layer gated recurrent unit (GRU) RNN to an input sequence.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.GRUCell" title="mxnet.gluon.rnn.GRUCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">GRUCell</span></code></a>(hidden_size[, …])</p></td> |
| <td><p>Gated Rectified Unit (GRU) network cell.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridRecurrentCell" title="mxnet.gluon.rnn.HybridRecurrentCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">HybridRecurrentCell</span></code></a>([prefix, params])</p></td> |
| <td><p>HybridRecurrentCell supports hybridize.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridSequentialRNNCell" title="mxnet.gluon.rnn.HybridSequentialRNNCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">HybridSequentialRNNCell</span></code></a>([prefix, params])</p></td> |
| <td><p>Sequentially stacking multiple HybridRNN cells.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.LSTM" title="mxnet.gluon.rnn.LSTM"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LSTM</span></code></a>(hidden_size[, num_layers, layout, …])</p></td> |
| <td><p>Applies a multi-layer long short-term memory (LSTM) RNN to an input sequence.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.LSTMCell" title="mxnet.gluon.rnn.LSTMCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LSTMCell</span></code></a>(hidden_size[, …])</p></td> |
| <td><p>Long-Short Term Memory (LSTM) network cell.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ModifierCell" title="mxnet.gluon.rnn.ModifierCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ModifierCell</span></code></a>(base_cell)</p></td> |
| <td><p>Base class for modifier cells.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RNN" title="mxnet.gluon.rnn.RNN"><code class="xref py py-obj docutils literal notranslate"><span class="pre">RNN</span></code></a>(hidden_size[, num_layers, activation, …])</p></td> |
| <td><p>Applies a multi-layer Elman RNN with <cite>tanh</cite> or <cite>ReLU</cite> non-linearity to an input sequence.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RNNCell" title="mxnet.gluon.rnn.RNNCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">RNNCell</span></code></a>(hidden_size[, activation, …])</p></td> |
| <td><p>Elman RNN recurrent neural network cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell" title="mxnet.gluon.rnn.RecurrentCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">RecurrentCell</span></code></a>([prefix, params])</p></td> |
| <td><p>Abstract base class for RNN cells</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ResidualCell" title="mxnet.gluon.rnn.ResidualCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ResidualCell</span></code></a>(base_cell)</p></td> |
| <td><p>Adds residual connection as described in Wu et al, 2016 (<a class="reference external" href="https://arxiv.org/abs/1609.08144">https://arxiv.org/abs/1609.08144</a>).</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.SequentialRNNCell" title="mxnet.gluon.rnn.SequentialRNNCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SequentialRNNCell</span></code></a>([prefix, params])</p></td> |
| <td><p>Sequentially stacking multiple RNN cells.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ZoneoutCell" title="mxnet.gluon.rnn.ZoneoutCell"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ZoneoutCell</span></code></a>(base_cell[, zoneout_outputs, …])</p></td> |
| <td><p>Applies Zoneout on base cell.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.BidirectionalCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">BidirectionalCell</code><span class="sig-paren">(</span><em class="sig-param">l_cell</em>, <em class="sig-param">r_cell</em>, <em class="sig-param">output_prefix='bi_'</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#BidirectionalCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.BidirectionalCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.HybridRecurrentCell</span></code></p> |
| <p>Bidirectional RNN cell.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>l_cell</strong> (<a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell" title="mxnet.gluon.rnn.RecurrentCell"><em>RecurrentCell</em></a>) – Cell for forward unrolling</p></li> |
| <li><p><strong>r_cell</strong> (<a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell" title="mxnet.gluon.rnn.RecurrentCell"><em>RecurrentCell</em></a>) – Cell for backward unrolling</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.BidirectionalCell.begin_state" title="mxnet.gluon.rnn.BidirectionalCell.begin_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">begin_state</span></code></a>(**kwargs)</p></td> |
| <td><p>Initial state for this cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.BidirectionalCell.state_info" title="mxnet.gluon.rnn.BidirectionalCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.BidirectionalCell.unroll" title="mxnet.gluon.rnn.BidirectionalCell.unroll"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unroll</span></code></a>(length, inputs[, begin_state, …])</p></td> |
| <td><p>Unrolls an RNN cell across time steps.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.BidirectionalCell.begin_state"> |
| <code class="sig-name descname">begin_state</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#BidirectionalCell.begin_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.BidirectionalCell.begin_state" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Initial state for this cell.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>func</strong> (<em>callable</em><em>, </em><em>default symbol.zeros</em>) – <p>Function for creating initial state.</p> |
| <p>For Symbol API, func can be <cite>symbol.zeros</cite>, <cite>symbol.uniform</cite>, |
| <cite>symbol.var etc</cite>. Use <cite>symbol.var</cite> if you want to directly |
| feed input as states.</p> |
| <p>For NDArray API, func can be <cite>ndarray.zeros</cite>, <cite>ndarray.ones</cite>, etc.</p> |
| </p></li> |
| <li><p><strong>batch_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – Only required for NDArray API. Size of the batch (‘N’ in layout) |
| dimension of input.</p></li> |
| <li><p><strong>**kwargs</strong> – Additional keyword arguments passed to func. For example |
| <cite>mean</cite>, <cite>std</cite>, <cite>dtype</cite>, etc.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>states</strong> – Starting states for the first RNN step.</p> |
| </dd> |
| <dt class="field-odd">Return type</dt> |
| <dd class="field-odd"><p>nested list of Symbol</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.BidirectionalCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#BidirectionalCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.BidirectionalCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.BidirectionalCell.unroll"> |
| <code class="sig-name descname">unroll</code><span class="sig-paren">(</span><em class="sig-param">length</em>, <em class="sig-param">inputs</em>, <em class="sig-param">begin_state=None</em>, <em class="sig-param">layout='NTC'</em>, <em class="sig-param">merge_outputs=None</em>, <em class="sig-param">valid_length=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#BidirectionalCell.unroll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.BidirectionalCell.unroll" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Unrolls an RNN cell across time steps.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>length</strong> (<em>int</em>) – Number of steps to unroll.</p></li> |
| <li><p><strong>inputs</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><em>list of Symbol</em><em>, or </em><em>None</em>) – <p>If <cite>inputs</cite> is a single Symbol (usually the output |
| of Embedding symbol), it should have shape |
| (batch_size, length, …) if <cite>layout</cite> is ‘NTC’, |
| or (length, batch_size, …) if <cite>layout</cite> is ‘TNC’.</p> |
| <p>If <cite>inputs</cite> is a list of symbols (usually output of |
| previous unroll), they should all have shape |
| (batch_size, …).</p> |
| </p></li> |
| <li><p><strong>begin_state</strong> (<em>nested list of Symbol</em><em>, </em><em>optional</em>) – Input states created by <cite>begin_state()</cite> |
| or output state of another cell. |
| Created from <cite>begin_state()</cite> if <cite>None</cite>.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>optional</em>) – <cite>layout</cite> of input symbol. Only used if inputs |
| is a single Symbol.</p></li> |
| <li><p><strong>merge_outputs</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>False</cite>, returns outputs as a list of Symbols. |
| If <cite>True</cite>, concatenates output across time steps |
| and returns a single symbol with shape |
| (batch_size, length, …) if layout is ‘NTC’, |
| or (length, batch_size, …) if layout is ‘TNC’. |
| If <cite>None</cite>, output whatever is faster.</p></li> |
| <li><p><strong>valid_length</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><em>None</em>) – <cite>valid_length</cite> specifies the length of the sequences in the batch without padding. |
| This option is especially useful for building sequence-to-sequence models where |
| the input and output sequences would potentially be padded. |
| If <cite>valid_length</cite> is None, all sequences are assumed to have the same length. |
| If <cite>valid_length</cite> is a Symbol or NDArray, it should have shape (batch_size,). |
| The ith element will be the length of the ith sequence in the batch. |
| The last valid state will be return and the padded outputs will be masked with 0. |
| Note that <cite>valid_length</cite> must be smaller or equal to <cite>length</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p><strong>outputs</strong> (<em>list of Symbol or Symbol</em>) – Symbol (if <cite>merge_outputs</cite> is True) or list of Symbols |
| (if <cite>merge_outputs</cite> is False) corresponding to the output from |
| the RNN from this unrolling.</p></li> |
| <li><p><strong>states</strong> (<em>list of Symbol</em>) – The new state of this RNN after this unrolling. |
| The type of this symbol is same as the output of <cite>begin_state()</cite>.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.DropoutCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">DropoutCell</code><span class="sig-paren">(</span><em class="sig-param">rate</em>, <em class="sig-param">axes=()</em>, <em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#DropoutCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.DropoutCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.HybridRecurrentCell</span></code></p> |
| <p>Applies dropout on input.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>rate</strong> (<em>float</em>) – Percentage of elements to drop out, which |
| is 1 - percentage to retain.</p></li> |
| <li><p><strong>axes</strong> (<em>tuple of int</em><em>, </em><em>default</em><em> (</em><em>)</em>) – The axes on which dropout mask is shared. If empty, regular dropout is applied.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.DropoutCell.hybrid_forward" title="mxnet.gluon.rnn.DropoutCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.DropoutCell.state_info" title="mxnet.gluon.rnn.DropoutCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.DropoutCell.unroll" title="mxnet.gluon.rnn.DropoutCell.unroll"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unroll</span></code></a>(length, inputs[, begin_state, …])</p></td> |
| <td><p>Unrolls an RNN cell across time steps.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="simple"> |
| <dt>Inputs:</dt><dd><ul class="simple"> |
| <li><p><strong>data</strong>: input tensor with shape <cite>(batch_size, size)</cite>.</p></li> |
| <li><p><strong>states</strong>: a list of recurrent state tensors.</p></li> |
| </ul> |
| </dd> |
| <dt>Outputs:</dt><dd><ul class="simple"> |
| <li><p><strong>out</strong>: output tensor with shape <cite>(batch_size, size)</cite>.</p></li> |
| <li><p><strong>next_states</strong>: returns input <cite>states</cite> directly.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.DropoutCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#DropoutCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.DropoutCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.DropoutCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#DropoutCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.DropoutCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.DropoutCell.unroll"> |
| <code class="sig-name descname">unroll</code><span class="sig-paren">(</span><em class="sig-param">length</em>, <em class="sig-param">inputs</em>, <em class="sig-param">begin_state=None</em>, <em class="sig-param">layout='NTC'</em>, <em class="sig-param">merge_outputs=None</em>, <em class="sig-param">valid_length=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#DropoutCell.unroll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.DropoutCell.unroll" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Unrolls an RNN cell across time steps.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>length</strong> (<em>int</em>) – Number of steps to unroll.</p></li> |
| <li><p><strong>inputs</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><em>list of Symbol</em><em>, or </em><em>None</em>) – <p>If <cite>inputs</cite> is a single Symbol (usually the output |
| of Embedding symbol), it should have shape |
| (batch_size, length, …) if <cite>layout</cite> is ‘NTC’, |
| or (length, batch_size, …) if <cite>layout</cite> is ‘TNC’.</p> |
| <p>If <cite>inputs</cite> is a list of symbols (usually output of |
| previous unroll), they should all have shape |
| (batch_size, …).</p> |
| </p></li> |
| <li><p><strong>begin_state</strong> (<em>nested list of Symbol</em><em>, </em><em>optional</em>) – Input states created by <cite>begin_state()</cite> |
| or output state of another cell. |
| Created from <cite>begin_state()</cite> if <cite>None</cite>.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>optional</em>) – <cite>layout</cite> of input symbol. Only used if inputs |
| is a single Symbol.</p></li> |
| <li><p><strong>merge_outputs</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>False</cite>, returns outputs as a list of Symbols. |
| If <cite>True</cite>, concatenates output across time steps |
| and returns a single symbol with shape |
| (batch_size, length, …) if layout is ‘NTC’, |
| or (length, batch_size, …) if layout is ‘TNC’. |
| If <cite>None</cite>, output whatever is faster.</p></li> |
| <li><p><strong>valid_length</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><em>None</em>) – <cite>valid_length</cite> specifies the length of the sequences in the batch without padding. |
| This option is especially useful for building sequence-to-sequence models where |
| the input and output sequences would potentially be padded. |
| If <cite>valid_length</cite> is None, all sequences are assumed to have the same length. |
| If <cite>valid_length</cite> is a Symbol or NDArray, it should have shape (batch_size,). |
| The ith element will be the length of the ith sequence in the batch. |
| The last valid state will be return and the padded outputs will be masked with 0. |
| Note that <cite>valid_length</cite> must be smaller or equal to <cite>length</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p><strong>outputs</strong> (<em>list of Symbol or Symbol</em>) – Symbol (if <cite>merge_outputs</cite> is True) or list of Symbols |
| (if <cite>merge_outputs</cite> is False) corresponding to the output from |
| the RNN from this unrolling.</p></li> |
| <li><p><strong>states</strong> (<em>list of Symbol</em>) – The new state of this RNN after this unrolling. |
| The type of this symbol is same as the output of <cite>begin_state()</cite>.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.GRU"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">GRU</code><span class="sig-paren">(</span><em class="sig-param">hidden_size</em>, <em class="sig-param">num_layers=1</em>, <em class="sig-param">layout='TNC'</em>, <em class="sig-param">dropout=0</em>, <em class="sig-param">bidirectional=False</em>, <em class="sig-param">input_size=0</em>, <em class="sig-param">i2h_weight_initializer=None</em>, <em class="sig-param">h2h_weight_initializer=None</em>, <em class="sig-param">i2h_bias_initializer='zeros'</em>, <em class="sig-param">h2h_bias_initializer='zeros'</em>, <em class="sig-param">dtype='float32'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_layer.html#GRU"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.GRU" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_layer._RNNLayer</span></code></p> |
| <p>Applies a multi-layer gated recurrent unit (GRU) RNN to an input sequence. |
| Note: this is an implementation of the cuDNN version of GRUs |
| (slight modification compared to Cho et al. 2014; the reset gate <span class="math notranslate nohighlight">\(r_t\)</span> |
| is applied after matrix multiplication).</p> |
| <p>For each element in the input sequence, each layer computes the following |
| function:</p> |
| <div class="math notranslate nohighlight"> |
| \[\begin{split}\begin{array}{ll} |
| r_t = sigmoid(W_{ir} x_t + b_{ir} + W_{hr} h_{(t-1)} + b_{hr}) \\ |
| i_t = sigmoid(W_{ii} x_t + b_{ii} + W_{hi} h_{(t-1)} + b_{hi}) \\ |
| n_t = \tanh(W_{in} x_t + b_{in} + r_t * (W_{hn} h_{(t-1)} + b_{hn})) \\ |
| h_t = (1 - i_t) * n_t + i_t * h_{(t-1)} \\ |
| \end{array}\end{split}\]</div> |
| <p>where <span class="math notranslate nohighlight">\(h_t\)</span> is the hidden state at time <cite>t</cite>, <span class="math notranslate nohighlight">\(x_t\)</span> is the hidden |
| state of the previous layer at time <cite>t</cite> or <span class="math notranslate nohighlight">\(input_t\)</span> for the first layer, |
| and <span class="math notranslate nohighlight">\(r_t\)</span>, <span class="math notranslate nohighlight">\(i_t\)</span>, <span class="math notranslate nohighlight">\(n_t\)</span> are the reset, input, and new gates, respectively.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>hidden_size</strong> (<em>int</em>) – The number of features in the hidden state h</p></li> |
| <li><p><strong>num_layers</strong> (<em>int</em><em>, </em><em>default 1</em>) – Number of recurrent layers.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>default 'TNC'</em>) – The format of input and output tensors. T, N and C stand for |
| sequence length, batch size, and feature dimensions respectively.</p></li> |
| <li><p><strong>dropout</strong> (<em>float</em><em>, </em><em>default 0</em>) – If non-zero, introduces a dropout layer on the outputs of each |
| RNN layer except the last layer</p></li> |
| <li><p><strong>bidirectional</strong> (<em>bool</em><em>, </em><em>default False</em>) – If True, becomes a bidirectional RNN.</p></li> |
| <li><p><strong>i2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the input weights matrix, used for the linear |
| transformation of the inputs.</p></li> |
| <li><p><strong>h2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the recurrent weights matrix, used for the linear |
| transformation of the recurrent state.</p></li> |
| <li><p><strong>i2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>h2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>dtype</strong> (<em>str</em><em>, </em><em>default 'float32'</em>) – Type to initialize the parameters and default states to</p></li> |
| <li><p><strong>input_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – The number of expected features in the input x. |
| If not specified, it will be inferred from input.</p></li> |
| <li><p><strong>prefix</strong> (<em>str</em><em> or </em><em>None</em>) – Prefix of this <cite>Block</cite>.</p></li> |
| <li><p><strong>params</strong> (<a class="reference internal" href="../parameter_dict.html#mxnet.gluon.ParameterDict" title="mxnet.gluon.ParameterDict"><em>ParameterDict</em></a><em> or </em><em>None</em>) – Shared Parameters for this <cite>Block</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="simple"> |
| <dt>Inputs:</dt><dd><ul class="simple"> |
| <li><p><strong>data</strong>: input tensor with shape <cite>(sequence_length, batch_size, input_size)</cite> |
| when <cite>layout</cite> is “TNC”. For other layouts, dimensions are permuted accordingly |
| using transpose() operator which adds performance overhead. Consider creating |
| batches in TNC layout during data batching step.</p></li> |
| <li><p><strong>states</strong>: initial recurrent state tensor with shape |
| <cite>(num_layers, batch_size, num_hidden)</cite>. If <cite>bidirectional</cite> is True, |
| shape will instead be <cite>(2*num_layers, batch_size, num_hidden)</cite>. If |
| <cite>states</cite> is None, zeros will be used as default begin states.</p></li> |
| </ul> |
| </dd> |
| <dt>Outputs:</dt><dd><ul class="simple"> |
| <li><p><strong>out</strong>: output tensor with shape <cite>(sequence_length, batch_size, num_hidden)</cite> |
| when <cite>layout</cite> is “TNC”. If <cite>bidirectional</cite> is True, output shape will instead |
| be <cite>(sequence_length, batch_size, 2*num_hidden)</cite></p></li> |
| <li><p><strong>out_states</strong>: output recurrent state tensor with the same shape as <cite>states</cite>. |
| If <cite>states</cite> is None <cite>out_states</cite> will not be returned.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p class="rubric">Examples</p> |
| <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">layer</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">gluon</span><span class="o">.</span><span class="n">rnn</span><span class="o">.</span><span class="n">GRU</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="n">layer</span><span class="o">.</span><span class="n">initialize</span><span class="p">()</span> |
| <span class="gp">>>> </span><span class="nb">input</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">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="c1"># by default zeros are used as begin state</span> |
| <span class="gp">>>> </span><span class="n">output</span> <span class="o">=</span> <span class="n">layer</span><span class="p">(</span><span class="nb">input</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="c1"># manually specify begin state.</span> |
| <span class="gp">>>> </span><span class="n">h0</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">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="n">output</span><span class="p">,</span> <span class="n">hn</span> <span class="o">=</span> <span class="n">layer</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">h0</span><span class="p">)</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.GRUCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">GRUCell</code><span class="sig-paren">(</span><em class="sig-param">hidden_size</em>, <em class="sig-param">i2h_weight_initializer=None</em>, <em class="sig-param">h2h_weight_initializer=None</em>, <em class="sig-param">i2h_bias_initializer='zeros'</em>, <em class="sig-param">h2h_bias_initializer='zeros'</em>, <em class="sig-param">input_size=0</em>, <em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#GRUCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.GRUCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.HybridRecurrentCell</span></code></p> |
| <p>Gated Rectified Unit (GRU) network cell. |
| Note: this is an implementation of the cuDNN version of GRUs |
| (slight modification compared to Cho et al. 2014; the reset gate <span class="math notranslate nohighlight">\(r_t\)</span> |
| is applied after matrix multiplication).</p> |
| <p>Each call computes the following function:</p> |
| <div class="math notranslate nohighlight"> |
| \[\begin{split}\begin{array}{ll} |
| r_t = sigmoid(W_{ir} x_t + b_{ir} + W_{hr} h_{(t-1)} + b_{hr}) \\ |
| i_t = sigmoid(W_{ii} x_t + b_{ii} + W_{hi} h_{(t-1)} + b_{hi}) \\ |
| n_t = \tanh(W_{in} x_t + b_{in} + r_t * (W_{hn} h_{(t-1)} + b_{hn})) \\ |
| h_t = (1 - i_t) * n_t + i_t * h_{(t-1)} \\ |
| \end{array}\end{split}\]</div> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.GRUCell.hybrid_forward" title="mxnet.gluon.rnn.GRUCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states, …)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.GRUCell.state_info" title="mxnet.gluon.rnn.GRUCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <p>where <span class="math notranslate nohighlight">\(h_t\)</span> is the hidden state at time <cite>t</cite>, <span class="math notranslate nohighlight">\(x_t\)</span> is the hidden |
| state of the previous layer at time <cite>t</cite> or <span class="math notranslate nohighlight">\(input_t\)</span> for the first layer, |
| and <span class="math notranslate nohighlight">\(r_t\)</span>, <span class="math notranslate nohighlight">\(i_t\)</span>, <span class="math notranslate nohighlight">\(n_t\)</span> are the reset, input, and new gates, respectively.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>hidden_size</strong> (<em>int</em>) – Number of units in output symbol.</p></li> |
| <li><p><strong>i2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the input weights matrix, used for the linear |
| transformation of the inputs.</p></li> |
| <li><p><strong>h2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the recurrent weights matrix, used for the linear |
| transformation of the recurrent state.</p></li> |
| <li><p><strong>i2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default 'zeros'</em>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>h2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default 'zeros'</em>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>prefix</strong> (str, default <code class="docutils literal notranslate"><span class="pre">'gru_'</span></code>) – prefix for name of <cite>Block`s |
| (and name of weight if params is `None</cite>).</p></li> |
| <li><p><strong>params</strong> (<a class="reference internal" href="../parameter.html#mxnet.gluon.Parameter" title="mxnet.gluon.Parameter"><em>Parameter</em></a><em> or </em><em>None</em><em>, </em><em>default None</em>) – Container for weight sharing between cells. |
| Created if <cite>None</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="simple"> |
| <dt>Inputs:</dt><dd><ul class="simple"> |
| <li><p><strong>data</strong>: input tensor with shape <cite>(batch_size, input_size)</cite>.</p></li> |
| <li><p><strong>states</strong>: a list of one initial recurrent state tensor with shape |
| <cite>(batch_size, num_hidden)</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt>Outputs:</dt><dd><ul class="simple"> |
| <li><p><strong>out</strong>: output tensor with shape <cite>(batch_size, num_hidden)</cite>.</p></li> |
| <li><p><strong>next_states</strong>: a list of one output recurrent state tensor with the |
| same shape as <cite>states</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.GRUCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em>, <em class="sig-param">i2h_weight</em>, <em class="sig-param">h2h_weight</em>, <em class="sig-param">i2h_bias</em>, <em class="sig-param">h2h_bias</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#GRUCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.GRUCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.GRUCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#GRUCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.GRUCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.HybridRecurrentCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">HybridRecurrentCell</code><span class="sig-paren">(</span><em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridRecurrentCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridRecurrentCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.RecurrentCell</span></code>, <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.block.HybridBlock</span></code></p> |
| <p>HybridRecurrentCell supports hybridize.</p> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridRecurrentCell.hybrid_forward" title="mxnet.gluon.rnn.HybridRecurrentCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, x, *args, **kwargs)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.HybridRecurrentCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">x</em>, <em class="sig-param">*args</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridRecurrentCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridRecurrentCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.HybridSequentialRNNCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">HybridSequentialRNNCell</code><span class="sig-paren">(</span><em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridSequentialRNNCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridSequentialRNNCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.HybridRecurrentCell</span></code></p> |
| <p>Sequentially stacking multiple HybridRNN cells.</p> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.add" title="mxnet.gluon.rnn.HybridSequentialRNNCell.add"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add</span></code></a>(cell)</p></td> |
| <td><p>Appends a cell into the stack.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.begin_state" title="mxnet.gluon.rnn.HybridSequentialRNNCell.begin_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">begin_state</span></code></a>(**kwargs)</p></td> |
| <td><p>Initial state for this cell.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.hybrid_forward" title="mxnet.gluon.rnn.HybridSequentialRNNCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.state_info" title="mxnet.gluon.rnn.HybridSequentialRNNCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.unroll" title="mxnet.gluon.rnn.HybridSequentialRNNCell.unroll"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unroll</span></code></a>(length, inputs[, begin_state, …])</p></td> |
| <td><p>Unrolls an RNN cell across time steps.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.HybridSequentialRNNCell.add"> |
| <code class="sig-name descname">add</code><span class="sig-paren">(</span><em class="sig-param">cell</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridSequentialRNNCell.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.add" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Appends a cell into the stack.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>cell</strong> (<a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell" title="mxnet.gluon.rnn.RecurrentCell"><em>RecurrentCell</em></a>) – The cell to add.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.HybridSequentialRNNCell.begin_state"> |
| <code class="sig-name descname">begin_state</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridSequentialRNNCell.begin_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.begin_state" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Initial state for this cell.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>func</strong> (<em>callable</em><em>, </em><em>default symbol.zeros</em>) – <p>Function for creating initial state.</p> |
| <p>For Symbol API, func can be <cite>symbol.zeros</cite>, <cite>symbol.uniform</cite>, |
| <cite>symbol.var etc</cite>. Use <cite>symbol.var</cite> if you want to directly |
| feed input as states.</p> |
| <p>For NDArray API, func can be <cite>ndarray.zeros</cite>, <cite>ndarray.ones</cite>, etc.</p> |
| </p></li> |
| <li><p><strong>batch_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – Only required for NDArray API. Size of the batch (‘N’ in layout) |
| dimension of input.</p></li> |
| <li><p><strong>**kwargs</strong> – Additional keyword arguments passed to func. For example |
| <cite>mean</cite>, <cite>std</cite>, <cite>dtype</cite>, etc.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>states</strong> – Starting states for the first RNN step.</p> |
| </dd> |
| <dt class="field-odd">Return type</dt> |
| <dd class="field-odd"><p>nested list of Symbol</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.HybridSequentialRNNCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridSequentialRNNCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.HybridSequentialRNNCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridSequentialRNNCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.HybridSequentialRNNCell.unroll"> |
| <code class="sig-name descname">unroll</code><span class="sig-paren">(</span><em class="sig-param">length</em>, <em class="sig-param">inputs</em>, <em class="sig-param">begin_state=None</em>, <em class="sig-param">layout='NTC'</em>, <em class="sig-param">merge_outputs=None</em>, <em class="sig-param">valid_length=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#HybridSequentialRNNCell.unroll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.HybridSequentialRNNCell.unroll" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Unrolls an RNN cell across time steps.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>length</strong> (<em>int</em>) – Number of steps to unroll.</p></li> |
| <li><p><strong>inputs</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><em>list of Symbol</em><em>, or </em><em>None</em>) – <p>If <cite>inputs</cite> is a single Symbol (usually the output |
| of Embedding symbol), it should have shape |
| (batch_size, length, …) if <cite>layout</cite> is ‘NTC’, |
| or (length, batch_size, …) if <cite>layout</cite> is ‘TNC’.</p> |
| <p>If <cite>inputs</cite> is a list of symbols (usually output of |
| previous unroll), they should all have shape |
| (batch_size, …).</p> |
| </p></li> |
| <li><p><strong>begin_state</strong> (<em>nested list of Symbol</em><em>, </em><em>optional</em>) – Input states created by <cite>begin_state()</cite> |
| or output state of another cell. |
| Created from <cite>begin_state()</cite> if <cite>None</cite>.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>optional</em>) – <cite>layout</cite> of input symbol. Only used if inputs |
| is a single Symbol.</p></li> |
| <li><p><strong>merge_outputs</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>False</cite>, returns outputs as a list of Symbols. |
| If <cite>True</cite>, concatenates output across time steps |
| and returns a single symbol with shape |
| (batch_size, length, …) if layout is ‘NTC’, |
| or (length, batch_size, …) if layout is ‘TNC’. |
| If <cite>None</cite>, output whatever is faster.</p></li> |
| <li><p><strong>valid_length</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><em>None</em>) – <cite>valid_length</cite> specifies the length of the sequences in the batch without padding. |
| This option is especially useful for building sequence-to-sequence models where |
| the input and output sequences would potentially be padded. |
| If <cite>valid_length</cite> is None, all sequences are assumed to have the same length. |
| If <cite>valid_length</cite> is a Symbol or NDArray, it should have shape (batch_size,). |
| The ith element will be the length of the ith sequence in the batch. |
| The last valid state will be return and the padded outputs will be masked with 0. |
| Note that <cite>valid_length</cite> must be smaller or equal to <cite>length</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p><strong>outputs</strong> (<em>list of Symbol or Symbol</em>) – Symbol (if <cite>merge_outputs</cite> is True) or list of Symbols |
| (if <cite>merge_outputs</cite> is False) corresponding to the output from |
| the RNN from this unrolling.</p></li> |
| <li><p><strong>states</strong> (<em>list of Symbol</em>) – The new state of this RNN after this unrolling. |
| The type of this symbol is same as the output of <cite>begin_state()</cite>.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.LSTM"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">LSTM</code><span class="sig-paren">(</span><em class="sig-param">hidden_size</em>, <em class="sig-param">num_layers=1</em>, <em class="sig-param">layout='TNC'</em>, <em class="sig-param">dropout=0</em>, <em class="sig-param">bidirectional=False</em>, <em class="sig-param">input_size=0</em>, <em class="sig-param">i2h_weight_initializer=None</em>, <em class="sig-param">h2h_weight_initializer=None</em>, <em class="sig-param">i2h_bias_initializer='zeros'</em>, <em class="sig-param">h2h_bias_initializer='zeros'</em>, <em class="sig-param">projection_size=None</em>, <em class="sig-param">h2r_weight_initializer=None</em>, <em class="sig-param">state_clip_min=None</em>, <em class="sig-param">state_clip_max=None</em>, <em class="sig-param">state_clip_nan=False</em>, <em class="sig-param">dtype='float32'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_layer.html#LSTM"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.LSTM" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_layer._RNNLayer</span></code></p> |
| <p>Applies a multi-layer long short-term memory (LSTM) RNN to an input sequence.</p> |
| <p>For each element in the input sequence, each layer computes the following |
| function:</p> |
| <div class="math notranslate nohighlight"> |
| \[\begin{split}\begin{array}{ll} |
| i_t = sigmoid(W_{ii} x_t + b_{ii} + W_{hi} h_{(t-1)} + b_{hi}) \\ |
| f_t = sigmoid(W_{if} x_t + b_{if} + W_{hf} h_{(t-1)} + b_{hf}) \\ |
| g_t = \tanh(W_{ig} x_t + b_{ig} + W_{hc} h_{(t-1)} + b_{hg}) \\ |
| o_t = sigmoid(W_{io} x_t + b_{io} + W_{ho} h_{(t-1)} + b_{ho}) \\ |
| c_t = f_t * c_{(t-1)} + i_t * g_t \\ |
| h_t = o_t * \tanh(c_t) |
| \end{array}\end{split}\]</div> |
| <p>where <span class="math notranslate nohighlight">\(h_t\)</span> is the hidden state at time <cite>t</cite>, <span class="math notranslate nohighlight">\(c_t\)</span> is the |
| cell state at time <cite>t</cite>, <span class="math notranslate nohighlight">\(x_t\)</span> is the hidden state of the previous |
| layer at time <cite>t</cite> or <span class="math notranslate nohighlight">\(input_t\)</span> for the first layer, and <span class="math notranslate nohighlight">\(i_t\)</span>, |
| <span class="math notranslate nohighlight">\(f_t\)</span>, <span class="math notranslate nohighlight">\(g_t\)</span>, <span class="math notranslate nohighlight">\(o_t\)</span> are the input, forget, cell, and |
| out gates, respectively.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>hidden_size</strong> (<em>int</em>) – The number of features in the hidden state h.</p></li> |
| <li><p><strong>num_layers</strong> (<em>int</em><em>, </em><em>default 1</em>) – Number of recurrent layers.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>default 'TNC'</em>) – The format of input and output tensors. T, N and C stand for |
| sequence length, batch size, and feature dimensions respectively.</p></li> |
| <li><p><strong>dropout</strong> (<em>float</em><em>, </em><em>default 0</em>) – If non-zero, introduces a dropout layer on the outputs of each |
| RNN layer except the last layer.</p></li> |
| <li><p><strong>bidirectional</strong> (<em>bool</em><em>, </em><em>default False</em>) – If <cite>True</cite>, becomes a bidirectional RNN.</p></li> |
| <li><p><strong>i2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the input weights matrix, used for the linear |
| transformation of the inputs.</p></li> |
| <li><p><strong>h2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the recurrent weights matrix, used for the linear |
| transformation of the recurrent state.</p></li> |
| <li><p><strong>i2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default 'lstmbias'</em>) – Initializer for the bias vector. By default, bias for the forget |
| gate is initialized to 1 while all other biases are initialized |
| to zero.</p></li> |
| <li><p><strong>h2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>projection_size</strong> (<em>int</em><em>, </em><em>default None</em>) – The number of features after projection.</p></li> |
| <li><p><strong>h2r_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default None</em>) – Initializer for the projected recurrent weights matrix, used for the linear |
| transformation of the recurrent state to the projected space.</p></li> |
| <li><p><strong>state_clip_min</strong> (<em>float</em><em> or </em><em>None</em><em>, </em><em>default None</em>) – Minimum clip value of LSTM states. This option must be used together with |
| state_clip_max. If None, clipping is not applied.</p></li> |
| <li><p><strong>state_clip_max</strong> (<em>float</em><em> or </em><em>None</em><em>, </em><em>default None</em>) – Maximum clip value of LSTM states. This option must be used together with |
| state_clip_min. If None, clipping is not applied.</p></li> |
| <li><p><strong>state_clip_nan</strong> (<em>boolean</em><em>, </em><em>default False</em>) – Whether to stop NaN from propagating in state by clipping it to min/max. |
| If the clipping range is not specified, this option is ignored.</p></li> |
| <li><p><strong>dtype</strong> (<em>str</em><em>, </em><em>default 'float32'</em>) – Type to initialize the parameters and default states to</p></li> |
| <li><p><strong>input_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – The number of expected features in the input x. |
| If not specified, it will be inferred from input.</p></li> |
| <li><p><strong>prefix</strong> (<em>str</em><em> or </em><em>None</em>) – Prefix of this <cite>Block</cite>.</p></li> |
| <li><p><strong>params</strong> (<cite>ParameterDict</cite> or <cite>None</cite>) – Shared Parameters for this <cite>Block</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="simple"> |
| <dt>Inputs:</dt><dd><ul class="simple"> |
| <li><p><strong>data</strong>: input tensor with shape <cite>(sequence_length, batch_size, input_size)</cite> |
| when <cite>layout</cite> is “TNC”. For other layouts, dimensions are permuted accordingly |
| using transpose() operator which adds performance overhead. Consider creating |
| batches in TNC layout during data batching step.</p></li> |
| <li><p><strong>states</strong>: a list of two initial recurrent state tensors. Each has shape |
| <cite>(num_layers, batch_size, num_hidden)</cite>. If <cite>bidirectional</cite> is True, |
| shape will instead be <cite>(2*num_layers, batch_size, num_hidden)</cite>. If |
| <cite>states</cite> is None, zeros will be used as default begin states.</p></li> |
| </ul> |
| </dd> |
| <dt>Outputs:</dt><dd><ul class="simple"> |
| <li><p><strong>out</strong>: output tensor with shape <cite>(sequence_length, batch_size, num_hidden)</cite> |
| when <cite>layout</cite> is “TNC”. If <cite>bidirectional</cite> is True, output shape will instead |
| be <cite>(sequence_length, batch_size, 2*num_hidden)</cite></p></li> |
| <li><p><strong>out_states</strong>: a list of two output recurrent state tensors with the same |
| shape as in <cite>states</cite>. If <cite>states</cite> is None <cite>out_states</cite> will not be returned.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p class="rubric">Examples</p> |
| <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">layer</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">gluon</span><span class="o">.</span><span class="n">rnn</span><span class="o">.</span><span class="n">LSTM</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="n">layer</span><span class="o">.</span><span class="n">initialize</span><span class="p">()</span> |
| <span class="gp">>>> </span><span class="nb">input</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">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="c1"># by default zeros are used as begin state</span> |
| <span class="gp">>>> </span><span class="n">output</span> <span class="o">=</span> <span class="n">layer</span><span class="p">(</span><span class="nb">input</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="c1"># manually specify begin state.</span> |
| <span class="gp">>>> </span><span class="n">h0</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">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="n">c0</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">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="n">output</span><span class="p">,</span> <span class="n">hn</span> <span class="o">=</span> <span class="n">layer</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="p">[</span><span class="n">h0</span><span class="p">,</span> <span class="n">c0</span><span class="p">])</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.LSTMCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">LSTMCell</code><span class="sig-paren">(</span><em class="sig-param">hidden_size</em>, <em class="sig-param">i2h_weight_initializer=None</em>, <em class="sig-param">h2h_weight_initializer=None</em>, <em class="sig-param">i2h_bias_initializer='zeros'</em>, <em class="sig-param">h2h_bias_initializer='zeros'</em>, <em class="sig-param">input_size=0</em>, <em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em>, <em class="sig-param">activation='tanh'</em>, <em class="sig-param">recurrent_activation='sigmoid'</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#LSTMCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.LSTMCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.HybridRecurrentCell</span></code></p> |
| <p>Long-Short Term Memory (LSTM) network cell.</p> |
| <p>Each call computes the following function:</p> |
| <div class="math notranslate nohighlight"> |
| \[\begin{split}\begin{array}{ll} |
| i_t = sigmoid(W_{ii} x_t + b_{ii} + W_{hi} h_{(t-1)} + b_{hi}) \\ |
| f_t = sigmoid(W_{if} x_t + b_{if} + W_{hf} h_{(t-1)} + b_{hf}) \\ |
| g_t = \tanh(W_{ig} x_t + b_{ig} + W_{hc} h_{(t-1)} + b_{hg}) \\ |
| o_t = sigmoid(W_{io} x_t + b_{io} + W_{ho} h_{(t-1)} + b_{ho}) \\ |
| c_t = f_t * c_{(t-1)} + i_t * g_t \\ |
| h_t = o_t * \tanh(c_t) |
| \end{array}\end{split}\]</div> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.LSTMCell.hybrid_forward" title="mxnet.gluon.rnn.LSTMCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states, …)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.LSTMCell.state_info" title="mxnet.gluon.rnn.LSTMCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <p>where <span class="math notranslate nohighlight">\(h_t\)</span> is the hidden state at time <cite>t</cite>, <span class="math notranslate nohighlight">\(c_t\)</span> is the |
| cell state at time <cite>t</cite>, <span class="math notranslate nohighlight">\(x_t\)</span> is the hidden state of the previous |
| layer at time <cite>t</cite> or <span class="math notranslate nohighlight">\(input_t\)</span> for the first layer, and <span class="math notranslate nohighlight">\(i_t\)</span>, |
| <span class="math notranslate nohighlight">\(f_t\)</span>, <span class="math notranslate nohighlight">\(g_t\)</span>, <span class="math notranslate nohighlight">\(o_t\)</span> are the input, forget, cell, and |
| out gates, respectively.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>hidden_size</strong> (<em>int</em>) – Number of units in output symbol.</p></li> |
| <li><p><strong>i2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the input weights matrix, used for the linear |
| transformation of the inputs.</p></li> |
| <li><p><strong>h2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the recurrent weights matrix, used for the linear |
| transformation of the recurrent state.</p></li> |
| <li><p><strong>i2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default 'zeros'</em>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>h2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default 'zeros'</em>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>prefix</strong> (str, default <code class="docutils literal notranslate"><span class="pre">'lstm_'</span></code>) – Prefix for name of <cite>Block`s |
| (and name of weight if params is `None</cite>).</p></li> |
| <li><p><strong>params</strong> (<a class="reference internal" href="../parameter.html#mxnet.gluon.Parameter" title="mxnet.gluon.Parameter"><em>Parameter</em></a><em> or </em><em>None</em><em>, </em><em>default None</em>) – Container for weight sharing between cells. |
| Created if <cite>None</cite>.</p></li> |
| <li><p><strong>activation</strong> (<em>str</em><em>, </em><em>default 'tanh'</em>) – Activation type to use. See nd/symbol Activation |
| for supported types.</p></li> |
| <li><p><strong>recurrent_activation</strong> (<em>str</em><em>, </em><em>default 'sigmoid'</em>) – Activation type to use for the recurrent step. See nd/symbol Activation |
| for supported types.</p></li> |
| <li><p><strong>Inputs</strong> – <ul> |
| <li><p><strong>data</strong>: input tensor with shape <cite>(batch_size, input_size)</cite>.</p></li> |
| <li><p><strong>states</strong>: a list of two initial recurrent state tensors. Each has shape |
| <cite>(batch_size, num_hidden)</cite>.</p></li> |
| </ul> |
| </p></li> |
| <li><p><strong>Outputs</strong> – <ul> |
| <li><p><strong>out</strong>: output tensor with shape <cite>(batch_size, num_hidden)</cite>.</p></li> |
| <li><p><strong>next_states</strong>: a list of two output recurrent state tensors. Each has |
| the same shape as <cite>states</cite>.</p></li> |
| </ul> |
| </p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.LSTMCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em>, <em class="sig-param">i2h_weight</em>, <em class="sig-param">h2h_weight</em>, <em class="sig-param">i2h_bias</em>, <em class="sig-param">h2h_bias</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#LSTMCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.LSTMCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.LSTMCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#LSTMCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.LSTMCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.ModifierCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">ModifierCell</code><span class="sig-paren">(</span><em class="sig-param">base_cell</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ModifierCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ModifierCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.HybridRecurrentCell</span></code></p> |
| <p>Base class for modifier cells. A modifier |
| cell takes a base cell, apply modifications |
| on it (e.g. Zoneout), and returns a new cell.</p> |
| <p>After applying modifiers the base cell should |
| no longer be called directly. The modifier cell |
| should be used instead.</p> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ModifierCell.begin_state" title="mxnet.gluon.rnn.ModifierCell.begin_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">begin_state</span></code></a>([func])</p></td> |
| <td><p>Initial state for this cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ModifierCell.hybrid_forward" title="mxnet.gluon.rnn.ModifierCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ModifierCell.state_info" title="mxnet.gluon.rnn.ModifierCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <p><strong>Attributes</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ModifierCell.params" title="mxnet.gluon.rnn.ModifierCell.params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">params</span></code></a></p></td> |
| <td><p>Returns this <code class="xref py py-class docutils literal notranslate"><span class="pre">Block</span></code>’s parameter dictionary (does not include its children’s parameters).</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ModifierCell.begin_state"> |
| <code class="sig-name descname">begin_state</code><span class="sig-paren">(</span><em class="sig-param">func=<function zeros></em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ModifierCell.begin_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ModifierCell.begin_state" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Initial state for this cell.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>func</strong> (<em>callable</em><em>, </em><em>default symbol.zeros</em>) – <p>Function for creating initial state.</p> |
| <p>For Symbol API, func can be <cite>symbol.zeros</cite>, <cite>symbol.uniform</cite>, |
| <cite>symbol.var etc</cite>. Use <cite>symbol.var</cite> if you want to directly |
| feed input as states.</p> |
| <p>For NDArray API, func can be <cite>ndarray.zeros</cite>, <cite>ndarray.ones</cite>, etc.</p> |
| </p></li> |
| <li><p><strong>batch_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – Only required for NDArray API. Size of the batch (‘N’ in layout) |
| dimension of input.</p></li> |
| <li><p><strong>**kwargs</strong> – Additional keyword arguments passed to func. For example |
| <cite>mean</cite>, <cite>std</cite>, <cite>dtype</cite>, etc.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>states</strong> – Starting states for the first RNN step.</p> |
| </dd> |
| <dt class="field-odd">Return type</dt> |
| <dd class="field-odd"><p>nested list of Symbol</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ModifierCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ModifierCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ModifierCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ModifierCell.params"> |
| <em class="property">property </em><code class="sig-name descname">params</code><a class="headerlink" href="#mxnet.gluon.rnn.ModifierCell.params" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Returns this <code class="xref py py-class docutils literal notranslate"><span class="pre">Block</span></code>’s parameter dictionary (does not include its |
| children’s parameters).</p> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ModifierCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ModifierCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ModifierCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.RNN"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">RNN</code><span class="sig-paren">(</span><em class="sig-param">hidden_size</em>, <em class="sig-param">num_layers=1</em>, <em class="sig-param">activation='relu'</em>, <em class="sig-param">layout='TNC'</em>, <em class="sig-param">dropout=0</em>, <em class="sig-param">bidirectional=False</em>, <em class="sig-param">i2h_weight_initializer=None</em>, <em class="sig-param">h2h_weight_initializer=None</em>, <em class="sig-param">i2h_bias_initializer='zeros'</em>, <em class="sig-param">h2h_bias_initializer='zeros'</em>, <em class="sig-param">input_size=0</em>, <em class="sig-param">dtype='float32'</em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_layer.html#RNN"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RNN" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_layer._RNNLayer</span></code></p> |
| <p>Applies a multi-layer Elman RNN with <cite>tanh</cite> or <cite>ReLU</cite> non-linearity to an input sequence.</p> |
| <p>For each element in the input sequence, each layer computes the following |
| function:</p> |
| <div class="math notranslate nohighlight"> |
| \[h_t = \tanh(w_{ih} * x_t + b_{ih} + w_{hh} * h_{(t-1)} + b_{hh})\]</div> |
| <p>where <span class="math notranslate nohighlight">\(h_t\)</span> is the hidden state at time <cite>t</cite>, and <span class="math notranslate nohighlight">\(x_t\)</span> is the output |
| of the previous layer at time <cite>t</cite> or <span class="math notranslate nohighlight">\(input_t\)</span> for the first layer. |
| If nonlinearity=’relu’, then <cite>ReLU</cite> is used instead of <cite>tanh</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>hidden_size</strong> (<em>int</em>) – The number of features in the hidden state h.</p></li> |
| <li><p><strong>num_layers</strong> (<em>int</em><em>, </em><em>default 1</em>) – Number of recurrent layers.</p></li> |
| <li><p><strong>activation</strong> (<em>{'relu'</em><em> or </em><em>'tanh'}</em><em>, </em><em>default 'relu'</em>) – The activation function to use.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>default 'TNC'</em>) – The format of input and output tensors. T, N and C stand for |
| sequence length, batch size, and feature dimensions respectively.</p></li> |
| <li><p><strong>dropout</strong> (<em>float</em><em>, </em><em>default 0</em>) – If non-zero, introduces a dropout layer on the outputs of each |
| RNN layer except the last layer.</p></li> |
| <li><p><strong>bidirectional</strong> (<em>bool</em><em>, </em><em>default False</em>) – If <cite>True</cite>, becomes a bidirectional RNN.</p></li> |
| <li><p><strong>i2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the input weights matrix, used for the linear |
| transformation of the inputs.</p></li> |
| <li><p><strong>h2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the recurrent weights matrix, used for the linear |
| transformation of the recurrent state.</p></li> |
| <li><p><strong>i2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>h2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>input_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – The number of expected features in the input x. |
| If not specified, it will be inferred from input.</p></li> |
| <li><p><strong>dtype</strong> (<em>str</em><em>, </em><em>default 'float32'</em>) – Type to initialize the parameters and default states to</p></li> |
| <li><p><strong>prefix</strong> (<em>str</em><em> or </em><em>None</em>) – Prefix of this <cite>Block</cite>.</p></li> |
| <li><p><strong>params</strong> (<a class="reference internal" href="../parameter_dict.html#mxnet.gluon.ParameterDict" title="mxnet.gluon.ParameterDict"><em>ParameterDict</em></a><em> or </em><em>None</em>) – Shared Parameters for this <cite>Block</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="simple"> |
| <dt>Inputs:</dt><dd><ul class="simple"> |
| <li><p><strong>data</strong>: input tensor with shape <cite>(sequence_length, batch_size, input_size)</cite> |
| when <cite>layout</cite> is “TNC”. For other layouts, dimensions are permuted accordingly |
| using transpose() operator which adds performance overhead. Consider creating |
| batches in TNC layout during data batching step.</p></li> |
| <li><p><strong>states</strong>: initial recurrent state tensor with shape |
| <cite>(num_layers, batch_size, num_hidden)</cite>. If <cite>bidirectional</cite> is True, |
| shape will instead be <cite>(2*num_layers, batch_size, num_hidden)</cite>. If |
| <cite>states</cite> is None, zeros will be used as default begin states.</p></li> |
| </ul> |
| </dd> |
| <dt>Outputs:</dt><dd><ul class="simple"> |
| <li><p><strong>out</strong>: output tensor with shape <cite>(sequence_length, batch_size, num_hidden)</cite> |
| when <cite>layout</cite> is “TNC”. If <cite>bidirectional</cite> is True, output shape will instead |
| be <cite>(sequence_length, batch_size, 2*num_hidden)</cite></p></li> |
| <li><p><strong>out_states</strong>: output recurrent state tensor with the same shape as <cite>states</cite>. |
| If <cite>states</cite> is None <cite>out_states</cite> will not be returned.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p class="rubric">Examples</p> |
| <div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">layer</span> <span class="o">=</span> <span class="n">mx</span><span class="o">.</span><span class="n">gluon</span><span class="o">.</span><span class="n">rnn</span><span class="o">.</span><span class="n">RNN</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="n">layer</span><span class="o">.</span><span class="n">initialize</span><span class="p">()</span> |
| <span class="gp">>>> </span><span class="nb">input</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">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">10</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="c1"># by default zeros are used as begin state</span> |
| <span class="gp">>>> </span><span class="n">output</span> <span class="o">=</span> <span class="n">layer</span><span class="p">(</span><span class="nb">input</span><span class="p">)</span> |
| <span class="gp">>>> </span><span class="c1"># manually specify begin state.</span> |
| <span class="gp">>>> </span><span class="n">h0</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">random</span><span class="o">.</span><span class="n">uniform</span><span class="p">(</span><span class="n">shape</span><span class="o">=</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">100</span><span class="p">))</span> |
| <span class="gp">>>> </span><span class="n">output</span><span class="p">,</span> <span class="n">hn</span> <span class="o">=</span> <span class="n">layer</span><span class="p">(</span><span class="nb">input</span><span class="p">,</span> <span class="n">h0</span><span class="p">)</span> |
| </pre></div> |
| </div> |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.RNNCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">RNNCell</code><span class="sig-paren">(</span><em class="sig-param">hidden_size</em>, <em class="sig-param">activation='tanh'</em>, <em class="sig-param">i2h_weight_initializer=None</em>, <em class="sig-param">h2h_weight_initializer=None</em>, <em class="sig-param">i2h_bias_initializer='zeros'</em>, <em class="sig-param">h2h_bias_initializer='zeros'</em>, <em class="sig-param">input_size=0</em>, <em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RNNCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RNNCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.HybridRecurrentCell</span></code></p> |
| <p>Elman RNN recurrent neural network cell.</p> |
| <p>Each call computes the following function:</p> |
| <div class="math notranslate nohighlight"> |
| \[h_t = \tanh(w_{ih} * x_t + b_{ih} + w_{hh} * h_{(t-1)} + b_{hh})\]</div> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RNNCell.hybrid_forward" title="mxnet.gluon.rnn.RNNCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states, …)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RNNCell.state_info" title="mxnet.gluon.rnn.RNNCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <p>where <span class="math notranslate nohighlight">\(h_t\)</span> is the hidden state at time <cite>t</cite>, and <span class="math notranslate nohighlight">\(x_t\)</span> is the hidden |
| state of the previous layer at time <cite>t</cite> or <span class="math notranslate nohighlight">\(input_t\)</span> for the first layer. |
| If nonlinearity=’relu’, then <cite>ReLU</cite> is used instead of <cite>tanh</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>hidden_size</strong> (<em>int</em>) – Number of units in output symbol</p></li> |
| <li><p><strong>activation</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><em>default 'tanh'</em>) – Type of activation function.</p></li> |
| <li><p><strong>i2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the input weights matrix, used for the linear |
| transformation of the inputs.</p></li> |
| <li><p><strong>h2h_weight_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a>) – Initializer for the recurrent weights matrix, used for the linear |
| transformation of the recurrent state.</p></li> |
| <li><p><strong>i2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default 'zeros'</em>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>h2h_bias_initializer</strong> (<em>str</em><em> or </em><a class="reference internal" href="../../initializer/index.html#mxnet.initializer.Initializer" title="mxnet.initializer.Initializer"><em>Initializer</em></a><em>, </em><em>default 'zeros'</em>) – Initializer for the bias vector.</p></li> |
| <li><p><strong>prefix</strong> (str, default <code class="docutils literal notranslate"><span class="pre">'rnn_'</span></code>) – Prefix for name of <cite>Block`s |
| (and name of weight if params is `None</cite>).</p></li> |
| <li><p><strong>params</strong> (<a class="reference internal" href="../parameter.html#mxnet.gluon.Parameter" title="mxnet.gluon.Parameter"><em>Parameter</em></a><em> or </em><em>None</em>) – Container for weight sharing between cells. |
| Created if <cite>None</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="simple"> |
| <dt>Inputs:</dt><dd><ul class="simple"> |
| <li><p><strong>data</strong>: input tensor with shape <cite>(batch_size, input_size)</cite>.</p></li> |
| <li><p><strong>states</strong>: a list of one initial recurrent state tensor with shape |
| <cite>(batch_size, num_hidden)</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt>Outputs:</dt><dd><ul class="simple"> |
| <li><p><strong>out</strong>: output tensor with shape <cite>(batch_size, num_hidden)</cite>.</p></li> |
| <li><p><strong>next_states</strong>: a list of one output recurrent state tensor with the |
| same shape as <cite>states</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.RNNCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em>, <em class="sig-param">i2h_weight</em>, <em class="sig-param">h2h_weight</em>, <em class="sig-param">i2h_bias</em>, <em class="sig-param">h2h_bias</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RNNCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RNNCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.RNNCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RNNCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RNNCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.RecurrentCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">RecurrentCell</code><span class="sig-paren">(</span><em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RecurrentCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RecurrentCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.block.Block</span></code></p> |
| <p>Abstract base class for RNN cells</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>prefix</strong> (<em>str</em><em>, </em><em>optional</em>) – Prefix for names of <cite>Block`s |
| (this prefix is also used for names of weights if `params</cite> is <cite>None</cite> |
| i.e. if <cite>params</cite> are being created and not reused)</p></li> |
| <li><p><strong>params</strong> (<a class="reference internal" href="../parameter.html#mxnet.gluon.Parameter" title="mxnet.gluon.Parameter"><em>Parameter</em></a><em> or </em><em>None</em><em>, </em><em>default None</em>) – Container for weight sharing between cells. |
| A new Parameter container is created if <cite>params</cite> is <cite>None</cite>.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell.begin_state" title="mxnet.gluon.rnn.RecurrentCell.begin_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">begin_state</span></code></a>([batch_size, func])</p></td> |
| <td><p>Initial state for this cell.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell.forward" title="mxnet.gluon.rnn.RecurrentCell.forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">forward</span></code></a>(inputs, states)</p></td> |
| <td><p>Unrolls the recurrent cell for one time step.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell.reset" title="mxnet.gluon.rnn.RecurrentCell.reset"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reset</span></code></a>()</p></td> |
| <td><p>Reset before re-using the cell for another graph.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell.state_info" title="mxnet.gluon.rnn.RecurrentCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell.unroll" title="mxnet.gluon.rnn.RecurrentCell.unroll"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unroll</span></code></a>(length, inputs[, begin_state, …])</p></td> |
| <td><p>Unrolls an RNN cell across time steps.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.RecurrentCell.begin_state"> |
| <code class="sig-name descname">begin_state</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em>, <em class="sig-param">func=<function zeros></em>, <em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RecurrentCell.begin_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RecurrentCell.begin_state" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Initial state for this cell.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>func</strong> (<em>callable</em><em>, </em><em>default symbol.zeros</em>) – <p>Function for creating initial state.</p> |
| <p>For Symbol API, func can be <cite>symbol.zeros</cite>, <cite>symbol.uniform</cite>, |
| <cite>symbol.var etc</cite>. Use <cite>symbol.var</cite> if you want to directly |
| feed input as states.</p> |
| <p>For NDArray API, func can be <cite>ndarray.zeros</cite>, <cite>ndarray.ones</cite>, etc.</p> |
| </p></li> |
| <li><p><strong>batch_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – Only required for NDArray API. Size of the batch (‘N’ in layout) |
| dimension of input.</p></li> |
| <li><p><strong>**kwargs</strong> – Additional keyword arguments passed to func. For example |
| <cite>mean</cite>, <cite>std</cite>, <cite>dtype</cite>, etc.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>states</strong> – Starting states for the first RNN step.</p> |
| </dd> |
| <dt class="field-odd">Return type</dt> |
| <dd class="field-odd"><p>nested list of Symbol</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.RecurrentCell.forward"> |
| <code class="sig-name descname">forward</code><span class="sig-paren">(</span><em class="sig-param">inputs</em>, <em class="sig-param">states</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RecurrentCell.forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RecurrentCell.forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Unrolls the recurrent cell for one time step.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>inputs</strong> (<em>sym.Variable</em>) – Input symbol, 2D, of shape (batch_size * num_units).</p></li> |
| <li><p><strong>states</strong> (<em>list of sym.Variable</em>) – RNN state from previous step or the output of begin_state().</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p><strong>output</strong> (<em>Symbol</em>) – Symbol corresponding to the output from the RNN when unrolling |
| for a single time step.</p></li> |
| <li><p><strong>states</strong> (<em>list of Symbol</em>) – The new state of this RNN after this unrolling. |
| The type of this symbol is same as the output of <cite>begin_state()</cite>. |
| This can be used as an input state to the next time step |
| of this RNN.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| <div class="admonition seealso"> |
| <p class="admonition-title">See also</p> |
| <dl class="simple"> |
| <dt><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell.begin_state" title="mxnet.gluon.rnn.RecurrentCell.begin_state"><code class="xref py py-meth docutils literal notranslate"><span class="pre">begin_state()</span></code></a></dt><dd><p>This function can provide the states for the first time step.</p> |
| </dd> |
| <dt><a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell.unroll" title="mxnet.gluon.rnn.RecurrentCell.unroll"><code class="xref py py-meth docutils literal notranslate"><span class="pre">unroll()</span></code></a></dt><dd><p>This function unrolls an RNN for a given number of (>=1) time steps.</p> |
| </dd> |
| </dl> |
| </div> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.RecurrentCell.reset"> |
| <code class="sig-name descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RecurrentCell.reset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RecurrentCell.reset" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Reset before re-using the cell for another graph.</p> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.RecurrentCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RecurrentCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RecurrentCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.RecurrentCell.unroll"> |
| <code class="sig-name descname">unroll</code><span class="sig-paren">(</span><em class="sig-param">length</em>, <em class="sig-param">inputs</em>, <em class="sig-param">begin_state=None</em>, <em class="sig-param">layout='NTC'</em>, <em class="sig-param">merge_outputs=None</em>, <em class="sig-param">valid_length=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#RecurrentCell.unroll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.RecurrentCell.unroll" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Unrolls an RNN cell across time steps.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>length</strong> (<em>int</em>) – Number of steps to unroll.</p></li> |
| <li><p><strong>inputs</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><em>list of Symbol</em><em>, or </em><em>None</em>) – <p>If <cite>inputs</cite> is a single Symbol (usually the output |
| of Embedding symbol), it should have shape |
| (batch_size, length, …) if <cite>layout</cite> is ‘NTC’, |
| or (length, batch_size, …) if <cite>layout</cite> is ‘TNC’.</p> |
| <p>If <cite>inputs</cite> is a list of symbols (usually output of |
| previous unroll), they should all have shape |
| (batch_size, …).</p> |
| </p></li> |
| <li><p><strong>begin_state</strong> (<em>nested list of Symbol</em><em>, </em><em>optional</em>) – Input states created by <cite>begin_state()</cite> |
| or output state of another cell. |
| Created from <cite>begin_state()</cite> if <cite>None</cite>.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>optional</em>) – <cite>layout</cite> of input symbol. Only used if inputs |
| is a single Symbol.</p></li> |
| <li><p><strong>merge_outputs</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>False</cite>, returns outputs as a list of Symbols. |
| If <cite>True</cite>, concatenates output across time steps |
| and returns a single symbol with shape |
| (batch_size, length, …) if layout is ‘NTC’, |
| or (length, batch_size, …) if layout is ‘TNC’. |
| If <cite>None</cite>, output whatever is faster.</p></li> |
| <li><p><strong>valid_length</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><em>None</em>) – <cite>valid_length</cite> specifies the length of the sequences in the batch without padding. |
| This option is especially useful for building sequence-to-sequence models where |
| the input and output sequences would potentially be padded. |
| If <cite>valid_length</cite> is None, all sequences are assumed to have the same length. |
| If <cite>valid_length</cite> is a Symbol or NDArray, it should have shape (batch_size,). |
| The ith element will be the length of the ith sequence in the batch. |
| The last valid state will be return and the padded outputs will be masked with 0. |
| Note that <cite>valid_length</cite> must be smaller or equal to <cite>length</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p><strong>outputs</strong> (<em>list of Symbol or Symbol</em>) – Symbol (if <cite>merge_outputs</cite> is True) or list of Symbols |
| (if <cite>merge_outputs</cite> is False) corresponding to the output from |
| the RNN from this unrolling.</p></li> |
| <li><p><strong>states</strong> (<em>list of Symbol</em>) – The new state of this RNN after this unrolling. |
| The type of this symbol is same as the output of <cite>begin_state()</cite>.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.ResidualCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">ResidualCell</code><span class="sig-paren">(</span><em class="sig-param">base_cell</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ResidualCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ResidualCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.ModifierCell</span></code></p> |
| <p>Adds residual connection as described in Wu et al, 2016 |
| (<a class="reference external" href="https://arxiv.org/abs/1609.08144">https://arxiv.org/abs/1609.08144</a>). |
| Output of the cell is output of the base cell plus input.</p> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ResidualCell.hybrid_forward" title="mxnet.gluon.rnn.ResidualCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ResidualCell.unroll" title="mxnet.gluon.rnn.ResidualCell.unroll"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unroll</span></code></a>(length, inputs[, begin_state, …])</p></td> |
| <td><p>Unrolls an RNN cell across time steps.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ResidualCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ResidualCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ResidualCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ResidualCell.unroll"> |
| <code class="sig-name descname">unroll</code><span class="sig-paren">(</span><em class="sig-param">length</em>, <em class="sig-param">inputs</em>, <em class="sig-param">begin_state=None</em>, <em class="sig-param">layout='NTC'</em>, <em class="sig-param">merge_outputs=None</em>, <em class="sig-param">valid_length=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ResidualCell.unroll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ResidualCell.unroll" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Unrolls an RNN cell across time steps.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>length</strong> (<em>int</em>) – Number of steps to unroll.</p></li> |
| <li><p><strong>inputs</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><em>list of Symbol</em><em>, or </em><em>None</em>) – <p>If <cite>inputs</cite> is a single Symbol (usually the output |
| of Embedding symbol), it should have shape |
| (batch_size, length, …) if <cite>layout</cite> is ‘NTC’, |
| or (length, batch_size, …) if <cite>layout</cite> is ‘TNC’.</p> |
| <p>If <cite>inputs</cite> is a list of symbols (usually output of |
| previous unroll), they should all have shape |
| (batch_size, …).</p> |
| </p></li> |
| <li><p><strong>begin_state</strong> (<em>nested list of Symbol</em><em>, </em><em>optional</em>) – Input states created by <cite>begin_state()</cite> |
| or output state of another cell. |
| Created from <cite>begin_state()</cite> if <cite>None</cite>.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>optional</em>) – <cite>layout</cite> of input symbol. Only used if inputs |
| is a single Symbol.</p></li> |
| <li><p><strong>merge_outputs</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>False</cite>, returns outputs as a list of Symbols. |
| If <cite>True</cite>, concatenates output across time steps |
| and returns a single symbol with shape |
| (batch_size, length, …) if layout is ‘NTC’, |
| or (length, batch_size, …) if layout is ‘TNC’. |
| If <cite>None</cite>, output whatever is faster.</p></li> |
| <li><p><strong>valid_length</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><em>None</em>) – <cite>valid_length</cite> specifies the length of the sequences in the batch without padding. |
| This option is especially useful for building sequence-to-sequence models where |
| the input and output sequences would potentially be padded. |
| If <cite>valid_length</cite> is None, all sequences are assumed to have the same length. |
| If <cite>valid_length</cite> is a Symbol or NDArray, it should have shape (batch_size,). |
| The ith element will be the length of the ith sequence in the batch. |
| The last valid state will be return and the padded outputs will be masked with 0. |
| Note that <cite>valid_length</cite> must be smaller or equal to <cite>length</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p><strong>outputs</strong> (<em>list of Symbol or Symbol</em>) – Symbol (if <cite>merge_outputs</cite> is True) or list of Symbols |
| (if <cite>merge_outputs</cite> is False) corresponding to the output from |
| the RNN from this unrolling.</p></li> |
| <li><p><strong>states</strong> (<em>list of Symbol</em>) – The new state of this RNN after this unrolling. |
| The type of this symbol is same as the output of <cite>begin_state()</cite>.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.SequentialRNNCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">SequentialRNNCell</code><span class="sig-paren">(</span><em class="sig-param">prefix=None</em>, <em class="sig-param">params=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#SequentialRNNCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.SequentialRNNCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.RecurrentCell</span></code></p> |
| <p>Sequentially stacking multiple RNN cells.</p> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.SequentialRNNCell.add" title="mxnet.gluon.rnn.SequentialRNNCell.add"><code class="xref py py-obj docutils literal notranslate"><span class="pre">add</span></code></a>(cell)</p></td> |
| <td><p>Appends a cell into the stack.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.SequentialRNNCell.begin_state" title="mxnet.gluon.rnn.SequentialRNNCell.begin_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">begin_state</span></code></a>(**kwargs)</p></td> |
| <td><p>Initial state for this cell.</p></td> |
| </tr> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.SequentialRNNCell.state_info" title="mxnet.gluon.rnn.SequentialRNNCell.state_info"><code class="xref py py-obj docutils literal notranslate"><span class="pre">state_info</span></code></a>([batch_size])</p></td> |
| <td><p>shape and layout information of states</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.SequentialRNNCell.unroll" title="mxnet.gluon.rnn.SequentialRNNCell.unroll"><code class="xref py py-obj docutils literal notranslate"><span class="pre">unroll</span></code></a>(length, inputs[, begin_state, …])</p></td> |
| <td><p>Unrolls an RNN cell across time steps.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.SequentialRNNCell.add"> |
| <code class="sig-name descname">add</code><span class="sig-paren">(</span><em class="sig-param">cell</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#SequentialRNNCell.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.SequentialRNNCell.add" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Appends a cell into the stack.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><p><strong>cell</strong> (<a class="reference internal" href="#mxnet.gluon.rnn.RecurrentCell" title="mxnet.gluon.rnn.RecurrentCell"><em>RecurrentCell</em></a>) – The cell to add.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.SequentialRNNCell.begin_state"> |
| <code class="sig-name descname">begin_state</code><span class="sig-paren">(</span><em class="sig-param">**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#SequentialRNNCell.begin_state"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.SequentialRNNCell.begin_state" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Initial state for this cell.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>func</strong> (<em>callable</em><em>, </em><em>default symbol.zeros</em>) – <p>Function for creating initial state.</p> |
| <p>For Symbol API, func can be <cite>symbol.zeros</cite>, <cite>symbol.uniform</cite>, |
| <cite>symbol.var etc</cite>. Use <cite>symbol.var</cite> if you want to directly |
| feed input as states.</p> |
| <p>For NDArray API, func can be <cite>ndarray.zeros</cite>, <cite>ndarray.ones</cite>, etc.</p> |
| </p></li> |
| <li><p><strong>batch_size</strong> (<em>int</em><em>, </em><em>default 0</em>) – Only required for NDArray API. Size of the batch (‘N’ in layout) |
| dimension of input.</p></li> |
| <li><p><strong>**kwargs</strong> – Additional keyword arguments passed to func. For example |
| <cite>mean</cite>, <cite>std</cite>, <cite>dtype</cite>, etc.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><strong>states</strong> – Starting states for the first RNN step.</p> |
| </dd> |
| <dt class="field-odd">Return type</dt> |
| <dd class="field-odd"><p>nested list of Symbol</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.SequentialRNNCell.state_info"> |
| <code class="sig-name descname">state_info</code><span class="sig-paren">(</span><em class="sig-param">batch_size=0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#SequentialRNNCell.state_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.SequentialRNNCell.state_info" title="Permalink to this definition">¶</a></dt> |
| <dd><p>shape and layout information of states</p> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.SequentialRNNCell.unroll"> |
| <code class="sig-name descname">unroll</code><span class="sig-paren">(</span><em class="sig-param">length</em>, <em class="sig-param">inputs</em>, <em class="sig-param">begin_state=None</em>, <em class="sig-param">layout='NTC'</em>, <em class="sig-param">merge_outputs=None</em>, <em class="sig-param">valid_length=None</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#SequentialRNNCell.unroll"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.SequentialRNNCell.unroll" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Unrolls an RNN cell across time steps.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>length</strong> (<em>int</em>) – Number of steps to unroll.</p></li> |
| <li><p><strong>inputs</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><em>list of Symbol</em><em>, or </em><em>None</em>) – <p>If <cite>inputs</cite> is a single Symbol (usually the output |
| of Embedding symbol), it should have shape |
| (batch_size, length, …) if <cite>layout</cite> is ‘NTC’, |
| or (length, batch_size, …) if <cite>layout</cite> is ‘TNC’.</p> |
| <p>If <cite>inputs</cite> is a list of symbols (usually output of |
| previous unroll), they should all have shape |
| (batch_size, …).</p> |
| </p></li> |
| <li><p><strong>begin_state</strong> (<em>nested list of Symbol</em><em>, </em><em>optional</em>) – Input states created by <cite>begin_state()</cite> |
| or output state of another cell. |
| Created from <cite>begin_state()</cite> if <cite>None</cite>.</p></li> |
| <li><p><strong>layout</strong> (<em>str</em><em>, </em><em>optional</em>) – <cite>layout</cite> of input symbol. Only used if inputs |
| is a single Symbol.</p></li> |
| <li><p><strong>merge_outputs</strong> (<em>bool</em><em>, </em><em>optional</em>) – If <cite>False</cite>, returns outputs as a list of Symbols. |
| If <cite>True</cite>, concatenates output across time steps |
| and returns a single symbol with shape |
| (batch_size, length, …) if layout is ‘NTC’, |
| or (length, batch_size, …) if layout is ‘TNC’. |
| If <cite>None</cite>, output whatever is faster.</p></li> |
| <li><p><strong>valid_length</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em>, </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a><em> or </em><em>None</em>) – <cite>valid_length</cite> specifies the length of the sequences in the batch without padding. |
| This option is especially useful for building sequence-to-sequence models where |
| the input and output sequences would potentially be padded. |
| If <cite>valid_length</cite> is None, all sequences are assumed to have the same length. |
| If <cite>valid_length</cite> is a Symbol or NDArray, it should have shape (batch_size,). |
| The ith element will be the length of the ith sequence in the batch. |
| The last valid state will be return and the padded outputs will be masked with 0. |
| Note that <cite>valid_length</cite> must be smaller or equal to <cite>length</cite>.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p><ul class="simple"> |
| <li><p><strong>outputs</strong> (<em>list of Symbol or Symbol</em>) – Symbol (if <cite>merge_outputs</cite> is True) or list of Symbols |
| (if <cite>merge_outputs</cite> is False) corresponding to the output from |
| the RNN from this unrolling.</p></li> |
| <li><p><strong>states</strong> (<em>list of Symbol</em>) – The new state of this RNN after this unrolling. |
| The type of this symbol is same as the output of <cite>begin_state()</cite>.</p></li> |
| </ul> |
| </p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| <dl class="class"> |
| <dt id="mxnet.gluon.rnn.ZoneoutCell"> |
| <em class="property">class </em><code class="sig-prename descclassname">mxnet.gluon.rnn.</code><code class="sig-name descname">ZoneoutCell</code><span class="sig-paren">(</span><em class="sig-param">base_cell</em>, <em class="sig-param">zoneout_outputs=0.0</em>, <em class="sig-param">zoneout_states=0.0</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ZoneoutCell"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ZoneoutCell" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">mxnet.gluon.rnn.rnn_cell.ModifierCell</span></code></p> |
| <p>Applies Zoneout on base cell.</p> |
| <p><strong>Methods</strong></p> |
| <table class="longtable docutils align-default"> |
| <colgroup> |
| <col style="width: 10%" /> |
| <col style="width: 90%" /> |
| </colgroup> |
| <tbody> |
| <tr class="row-odd"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ZoneoutCell.hybrid_forward" title="mxnet.gluon.rnn.ZoneoutCell.hybrid_forward"><code class="xref py py-obj docutils literal notranslate"><span class="pre">hybrid_forward</span></code></a>(F, inputs, states)</p></td> |
| <td><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p></td> |
| </tr> |
| <tr class="row-even"><td><p><a class="reference internal" href="#mxnet.gluon.rnn.ZoneoutCell.reset" title="mxnet.gluon.rnn.ZoneoutCell.reset"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reset</span></code></a>()</p></td> |
| <td><p>Reset before re-using the cell for another graph.</p></td> |
| </tr> |
| </tbody> |
| </table> |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ZoneoutCell.hybrid_forward"> |
| <code class="sig-name descname">hybrid_forward</code><span class="sig-paren">(</span><em class="sig-param">F</em>, <em class="sig-param">inputs</em>, <em class="sig-param">states</em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ZoneoutCell.hybrid_forward"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ZoneoutCell.hybrid_forward" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Overrides to construct symbolic graph for this <cite>Block</cite>.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>x</strong> (<a class="reference internal" href="../../symbol/symbol.html#mxnet.symbol.Symbol" title="mxnet.symbol.Symbol"><em>Symbol</em></a><em> or </em><a class="reference internal" href="../../ndarray/ndarray.html#mxnet.ndarray.NDArray" title="mxnet.ndarray.NDArray"><em>NDArray</em></a>) – The first input tensor.</p></li> |
| <li><p><strong>*args</strong> (<em>list of Symbol</em><em> or </em><em>list of NDArray</em>) – Additional input tensors.</p></li> |
| </ul> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="method"> |
| <dt id="mxnet.gluon.rnn.ZoneoutCell.reset"> |
| <code class="sig-name descname">reset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/mxnet/gluon/rnn/rnn_cell.html#ZoneoutCell.reset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mxnet.gluon.rnn.ZoneoutCell.reset" title="Permalink to this definition">¶</a></dt> |
| <dd><p>Reset before re-using the cell for another graph.</p> |
| </dd></dl> |
| |
| </dd></dl> |
| |
| </div> |
| </div> |
| |
| |
| <hr class="feedback-hr-top" /> |
| <div class="feedback-container"> |
| <div class="feedback-question">Did this page help you?</div> |
| <div class="feedback-answer-container"> |
| <div class="feedback-answer yes-link" data-response="yes">Yes</div> |
| <div class="feedback-answer no-link" data-response="no">No</div> |
| </div> |
| <div class="feedback-thank-you">Thanks for your feedback!</div> |
| </div> |
| <hr class="feedback-hr-bottom" /> |
| </div> |
| <div class="side-doc-outline"> |
| <div class="side-doc-outline--content"> |
| <div class="localtoc"> |
| <p class="caption"> |
| <span class="caption-text">Table Of Contents</span> |
| </p> |
| <ul> |
| <li><a class="reference internal" href="#">gluon.rnn</a><ul> |
| <li><a class="reference internal" href="#recurrent-cells">Recurrent Cells</a></li> |
| <li><a class="reference internal" href="#recurrent-layers">Recurrent Layers</a></li> |
| <li><a class="reference internal" href="#module-mxnet.gluon.rnn">API Reference</a></li> |
| </ul> |
| </li> |
| </ul> |
| |
| </div> |
| </div> |
| </div> |
| |
| <div class="clearer"></div> |
| </div><div class="pagenation"> |
| <a id="button-prev" href="../nn/index.html" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--colored" role="botton" accesskey="P"> |
| <i class="pagenation-arrow-L fas fa-arrow-left fa-lg"></i> |
| <div class="pagenation-text"> |
| <span class="pagenation-direction">Previous</span> |
| <div>gluon.nn</div> |
| </div> |
| </a> |
| <a id="button-next" href="../utils/index.html" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--colored" role="botton" accesskey="N"> |
| <i class="pagenation-arrow-R fas fa-arrow-right fa-lg"></i> |
| <div class="pagenation-text"> |
| <span class="pagenation-direction">Next</span> |
| <div>gluon.utils</div> |
| </div> |
| </a> |
| </div> |
| <footer class="site-footer h-card"> |
| <div class="wrapper"> |
| <div class="row"> |
| <div class="col-4"> |
| <h4 class="footer-category-title">Resources</h4> |
| <ul class="contact-list"> |
| <li><a class="u-email" href="mailto:dev@mxnet.apache.org">Dev list</a></li> |
| <li><a class="u-email" href="mailto:user@mxnet.apache.org">User mailing list</a></li> |
| <li><a href="https://cwiki.apache.org/confluence/display/MXNET/Apache+MXNet+Home">Developer Wiki</a></li> |
| <li><a href="https://issues.apache.org/jira/projects/MXNET/issues">Jira Tracker</a></li> |
| <li><a href="https://github.com/apache/incubator-mxnet/labels/Roadmap">Github Roadmap</a></li> |
| <li><a href="https://discuss.mxnet.io">MXNet Discuss forum</a></li> |
| <li><a href="/community/contribute">Contribute To MXNet</a></li> |
| |
| </ul> |
| </div> |
| |
| <div class="col-4"><ul class="social-media-list"><li><a href="https://github.com/apache/incubator-mxnet"><svg class="svg-icon"><use xlink:href="../../../_static/minima-social-icons.svg#github"></use></svg> <span class="username">apache/incubator-mxnet</span></a></li><li><a href="https://www.twitter.com/apachemxnet"><svg class="svg-icon"><use xlink:href="../../../_static/minima-social-icons.svg#twitter"></use></svg> <span class="username">apachemxnet</span></a></li><li><a href="https://youtube.com/apachemxnet"><svg class="svg-icon"><use xlink:href="../../../_static/minima-social-icons.svg#youtube"></use></svg> <span class="username">apachemxnet</span></a></li></ul> |
| </div> |
| |
| <div class="col-4 footer-text"> |
| <p>A flexible and efficient library for deep learning.</p> |
| </div> |
| </div> |
| </div> |
| </footer> |
| |
| <footer class="site-footer2"> |
| <div class="wrapper"> |
| <div class="row"> |
| <div class="col-3"> |
| <img src="../../../_static/apache_incubator_logo.png" class="footer-logo col-2"> |
| </div> |
| <div class="footer-bottom-warning col-9"> |
| <p>Apache MXNet is an effort undergoing incubation at The Apache Software Foundation (ASF), <span style="font-weight:bold">sponsored by the <i>Apache Incubator</i></span>. 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> |
| </footer> |
| |
| </body> |
| </html> |