Struct rcudnn::utils::RnnConfig [−][src]
pub struct RnnConfig {
pub hidden_size: c_int,
pub num_layers: c_int,
pub sequence_length: c_int,
// some fields omitted
}
Expand description
Provides an interfaces for CUDNN’s Rnn Descriptor
Arguments
rnn_desc
Previously created descriptorhidden_size
Size of the hidden layernum_layers
Number of layersdropout_desc
Descriptor to a previously created & initialized dropout descriptor, applied between layers.input_mode
Specifies behaviour at the input to the first layerdirection_mode
Specifies the recurrence pattern - i.e bidirectionalrnn_mode
Type of network used in routines ForwardInference, ForwardTraining, BackwardData, BackwardWeights. Can be ReLU, tanh, LSTM (Long Short Term Memory), or GRU (Gated Recurrent Unit).algo
- Only required in v6 implementation FIXME: Should this be checked in compilation?data_type
Math Precision - default f32
The LSTM network offered by CUDNN is a four-gate network that does not use peephole connections.
Greff, et al. (2015)1 suggests it doesn’t matter what kind of network it is, although
Jozefowicz, et al. (2015)2 suggests that the most important gates are the forget and input,
followed by the output gate, so the peephole connection isn’t as important to be concerned with.
A positive bias, as encouraged in the paper, can be achieved by setting bias_mode
to
CUDNN_RNN_DOUBLE_BIAS, which is the default, or CUDN_RNN_SINGLE_INP_BIAS or
CUDNN_RNN_SINGLE_REC_BIAS
Fields
Size of Hidden Layer
num_layers: c_int
Number of Hidden Layers
sequence_length: c_int
Length of Sequence
Implementations
pub fn new(
rnn_desc: RnnDescriptor,
hidden_size: i32,
num_layers: i32,
sequence_length: i32,
dropout_desc: cudnnDropoutDescriptor_t,
input_mode: cudnnRNNInputMode_t,
direction_mode: cudnnDirectionMode_t,
rnn_mode: cudnnRNNMode_t,
algo: cudnnRNNAlgo_t,
data_type: cudnnDataType_t,
workspace_size: usize,
training_reserve_size: usize,
training_reserve: CudaDeviceMemory
) -> RnnConfig
pub fn new(
rnn_desc: RnnDescriptor,
hidden_size: i32,
num_layers: i32,
sequence_length: i32,
dropout_desc: cudnnDropoutDescriptor_t,
input_mode: cudnnRNNInputMode_t,
direction_mode: cudnnDirectionMode_t,
rnn_mode: cudnnRNNMode_t,
algo: cudnnRNNAlgo_t,
data_type: cudnnDataType_t,
workspace_size: usize,
training_reserve_size: usize,
training_reserve: CudaDeviceMemory
) -> RnnConfig
Initialise a RNN Config
Workspace Size required for RNN Operations
Largest Workspace Size for RNN
Training Reserve Size for RNN
Training Reserve Space on GPU for RNN
Accessor function for Rnn Descriptor
Accessor function for Sequence Length