The RNNCell class supports a simple RNN cell that updates the hidden state: h' = activation(W_ih * x + b_ih + W_hh * h + b_hh) using two biases instead of one.
Value parameters
- activation
-
activation function to use: "tanh" (default) or "relu"
- hiddenSize
-
number of hidden units
- inputSize
-
number of input features
Attributes
- See also
- Companion
- object
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Perform the forward pass for the RNN cell using fused operations. Computes the next hidden state based on the input and the previous hidden state.
Perform the forward pass for the RNN cell using fused operations. Computes the next hidden state based on the input and the previous hidden state.
Value parameters
- inputs
-
an indexed sequence containing: -
input: the input tensor at the current time step -hPrev: the hidden state tensor from the previous time step
Attributes
- Returns
-
an indexed sequence containing the next hidden state tensor
- Throws
-
IllegalArgumentException
if the number of inputs is not exactly 2
- Definition Classes
Perform the forward pass for the RNN cell without using fused operations. Computes the next hidden state based on the input and the previous hidden state.
Perform the forward pass for the RNN cell without using fused operations. Computes the next hidden state based on the input and the previous hidden state.
Value parameters
- inputs
-
an indexed sequence containing: -
input: the input tensor at the current time step -hPrev: the hidden state tensor from the previous time step
Attributes
- Returns
-
an indexed sequence containing the next hidden state tensor
- Throws
-
IllegalArgumentException
if the number of inputs is not exactly 2
Number of state tensors tracked by the cell (e.g., 1 for RNN/GRU, 2 for LSTM).
Number of state tensors tracked by the cell (e.g., 1 for RNN/GRU, 2 for LSTM).
Attributes
- Definition Classes
-
RNNCellBase
Return the parameters of the cell.
Return the parameters of the cell.
Attributes
- Returns
-
sequence of parameters
- Definition Classes
-
RNNCellBase -> BaseModule
Inherited methods
Alias for forward, allows calling the module as a function: module(xs).
Alias for forward, allows calling the module as a function: module(xs).
Attributes
- Inherited from:
- SeqModule
Set the module to evaluation mode (and all submodules recursively).
Set the module to evaluation mode (and all submodules recursively).
Attributes
- Inherited from:
- BaseModule
Return the gradients of all parameters.
Create a batch of zero-initialized tracking states. You pass in the batch size to get properly shaped tensors: (batchSize, hiddenSize, 1)
Create a batch of zero-initialized tracking states. You pass in the batch size to get properly shaped tensors: (batchSize, hiddenSize, 1)
Attributes
- Inherited from:
- RNNCellBase (hidden)
Replace the current parameters with new ones. Useful for weight updates, loading saved models, etc.
Replace the current parameters with new ones. Useful for weight updates, loading saved models, etc.
Value parameters
- newParams
-
The new parameter list to assign
Attributes
- Inherited from:
- BaseModule
Set the module to training mode (and all submodules recursively).
Set the module to training mode (and all submodules recursively).
Attributes
- Inherited from:
- BaseModule
Zero out all gradients (in-place).
Inherited fields
Flag to control training or evaluation behavior.
Automatically detect submodules (other BaseModules) within this module.
Automatically detect submodules (other BaseModules) within this module.
Attributes
- Inherited from:
- BaseModule