AI::MXNet::RNN::Params - A container for holding variables.
A container for holding variables. Used by RNN cells for parameter sharing between cells. Parameters ---------- prefix : str All variables name created by this container will be prepended with the prefix
Get a variable with the name or create a new one if does not exist. Parameters ---------- $name : str name of the variable @kwargs: more arguments that are passed to mx->sym->Variable call
AI::MXNet::RNNCell::Base
Abstract base class for RNN cells Parameters ---------- prefix : str prefix for name of layers (and name of weight if params is undef) params : AI::MXNet::RNN::Params or undef container for weight sharing between cells. created if undef.
Reset before re-using the cell for another graph
Construct symbol for one step of RNN. Parameters ---------- $inputs : mx->sym->Variable input symbol, 2D, batch * num_units $states : mx->sym->Variable or ArrayRef[AI::MXNet::Symbol] state from previous step or begin_state(). Returns ------- $output : AI::MXNet::Symbol output symbol $states : ArrayRef[AI::MXNet::Symbol] state to next step of RNN. Can be called via overloaded &{}: &{$cell}($inputs, $states);
Parameters of this cell
shape(s) of states
shape and layout information of states
Initial state for this cell. Parameters ---------- :$func : sub ref, default is AI::MXNet::Symbol->can('zeros') Function for creating initial state. Can be AI::MXNet::Symbol->can('zeros'), AI::MXNet::Symbol->can('uniform'), AI::MXNet::Symbol->can('Variable') etc. Use AI::MXNet::Symbol->can('Variable') if you want to directly feed the input as states. @kwargs : more keyword arguments passed to func. For example mean, std, dtype, etc. Returns ------- $states : ArrayRef[AI::MXNet::Symbol] starting states for first RNN step
Unpack fused weight matrices into separate weight matrices Parameters ---------- $args : HashRef[AI::MXNet::NDArray] hash ref containing packed weights. usually from AI::MXNet::Module->get_output() Returns ------- $args : HashRef[AI::MXNet::NDArray] hash ref with weights associated with this cell, unpacked.
Pack fused weight matrices into common weight matrices Parameters ---------- args : HashRef[AI::MXNet::NDArray] hash ref containing unpacked weights. Returns ------- $args : HashRef[AI::MXNet::NDArray] hash ref with weights associated with this cell, packed.
Unroll an RNN cell across time steps. Parameters ---------- :$length : Int number of steps to unroll :$inputs : AI::MXNet::Symbol, array ref of Symbols, or undef if inputs is a single Symbol (usually the output of Embedding symbol), it should have shape of [$batch_size, $length, ...] if layout == 'NTC' (batch, time series) or ($length, $batch_size, ...) if layout == 'TNC' (time series, batch). If inputs is a array ref of symbols (usually output of previous unroll), they should all have shape ($batch_size, ...). If inputs is undef, a placeholder variables are automatically created. :$begin_state : array ref of Symbol input states. Created by begin_state() or output state of another cell. Created from begin_state() if undef. :$input_prefix : str prefix for automatically created input placehodlers. :$layout : str layout of input symbol. Only used if the input is a single Symbol. :$merge_outputs : Bool If 0, returns outputs as an array ref of Symbols. If 1, concatenates the output across the time steps and returns a single symbol with the shape [$batch_size, $length, ...) if the layout equal to 'NTC', or [$length, $batch_size, ...) if the layout equal tp 'TNC'. If undef, output whatever is faster Returns ------- $outputs : array ref of Symbol or Symbol output symbols. $states : Symbol or nested list of Symbol has the same structure as begin_state()
AI::MXNet::RNN::Cell
Simple recurrent neural network cell Parameters ---------- num_hidden : int number of units in output symbol activation : str or Symbol, default 'tanh' type of activation function prefix : str, default 'rnn_' prefix for name of layers (and name of weight if params is undef) params : AI::MXNet::RNNParams or undef container for weight sharing between cells. created if undef.
AI::MXNet::RNN::LSTMCell
Long-Short Term Memory (LSTM) network cell. Parameters ---------- num_hidden : int number of units in output symbol prefix : str, default 'lstm_' prefix for name of layers (and name of weight if params is undef) params : AI::MXNet::RNN::Params or None container for weight sharing between cells. created if undef. forget_bias : bias added to forget gate, default 1.0. Jozefowicz et al. 2015 recommends setting this to 1.0
AI::MXNet::RNN::GRUCell
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). Parameters ---------- num_hidden : int number of units in output symbol prefix : str, default 'gru_' prefix for name of layers (and name of weight if params is undef) params : AI::MXNet::RNN::Params or undef container for weight sharing between cells. created if undef.
AI::MXNet::RNN::FusedCell
Fusing RNN layers across time step into one kernel. Improves speed but is less flexible. Currently only supported if using cuDNN on GPU.
Unfuse the fused RNN Returns ------- $cell : AI::MXNet::RNN::SequentialCell unfused cell that can be used for stepping, and can run on CPU.
AI:MXNet::RNN::SequentialCell
Sequentially stacking multiple RNN cells Parameters ---------- params : AI::MXNet::RNN::Params or undef container for weight sharing between cells. created if undef.
Append a cell to the stack. Parameters ---------- $cell : AI::MXNet::RNN::Cell::Base
AI::MXNet::RNN::BidirectionalCell
Bidirectional RNN cell Parameters ---------- l_cell : AI::MXNet::RNN::Cell::Base cell for forward unrolling r_cell : AI::MXNet::RNN::Cell::Base cell for backward unrolling output_prefix : str, default 'bi_' prefix for name of output
AI::MXNet::RNN::Conv::Base
Abstract base class for Convolutional RNN cells
AI::MXNet::RNN::ConvCell
Convolutional RNN cells Parameters ---------- input_shape : array ref of int Shape of input in single timestep. num_hidden : int Number of units in output symbol. h2h_kernel : array ref of int, default (3, 3) Kernel of Convolution operator in state-to-state transitions. h2h_dilate : array ref of int, default (1, 1) Dilation of Convolution operator in state-to-state transitions. i2h_kernel : array ref of int, default (3, 3) Kernel of Convolution operator in input-to-state transitions. i2h_stride : array ref of int, default (1, 1) Stride of Convolution operator in input-to-state transitions. i2h_pad : array ref of int, default (1, 1) Pad of Convolution operator in input-to-state transitions. i2h_dilate : array ref of int, default (1, 1) Dilation of Convolution operator in input-to-state transitions. activation : str or Symbol, default functools.partial(symbol.LeakyReLU, act_type='leaky', slope=0.2) Type of activation function. prefix : str, default 'ConvRNN_' Prefix for name of layers (and name of weight if params is None). params : RNNParams, default None Container for weight sharing between cells. Created if None. conv_layout : str, , default 'NCHW' Layout of ConvolutionOp
AI::MXNet::RNN::ConvLSTMCell
Convolutional LSTM network cell. Reference: Xingjian et al. NIPS2015
AI::MXNet::RNN::ConvGRUCell
Convolutional GRU network cell.
AI::MXNet::RNN::ModifierCell
Base class for modifier cells. A modifier cell takes a base cell, apply modifications on it (e.g. Dropout), and returns a new cell. After applying modifiers the base cell should no longer be called directly. The modifer cell should be used instead.
AI::MXNet::RNN::DropoutCell
Apply the dropout on base cell
AI::MXNet::RNN::ZoneoutCell
Apply Zoneout on base cell.
AI::MXNet::RNN::ResidualCell
Adds residual connection as described in Wu et al, 2016 (https://arxiv.org/abs/1609.08144). Output of the cell is output of the base cell plus input.
To install AI::MXNet, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AI::MXNet
CPAN shell
perl -MCPAN -e shell install AI::MXNet
For more information on module installation, please visit the detailed CPAN module installation guide.