RNNCell
The RNNCell trait defines the structure and operations for a Recurrent Neural Network (RNN) cell. It includes weight matrices, bias vectors, and hidden states, along with methods for gradient clipping and parameter updates.
Attributes
- Graph
-
- Supertypes
- Known subtypes
-
class RNN
Members list
Type members
Classlikes
Case class representing the hidden state of the RNN.
Case class representing the hidden state of the RNN.
Value parameters
- grad
-
tensor for hidden state gradients
- n_mem
-
number of memory units
- n_seq
-
number of sequences
- param
-
tensor for hidden state parameters
- pre_act_grad
-
matrix for pre-activation gradients
- seq_length
-
length of each sequence
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Inherited classlikes
Case class representing a group of parameters, including the parameter itself, its velocity, and its gradient.
Case class representing a group of parameters, including the parameter itself, its velocity, and its gradient.
Value parameters
- grad
-
the gradient of the parameter, used for updating the parameter during training
- param
-
the parameter (e.g., weights or biases)
- velocity
-
the velocity associated with the parameter, used for momentum in optimization
Attributes
- Inherited from:
- RecurrentBase
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Value members
Concrete methods
Clip the gradients of the model parameters to a specified threshold. This method ensures that the gradients do not exceed the given threshold to prevent exploding gradients.
Clip the gradients of the model parameters to a specified threshold. This method ensures that the gradients do not exceed the given threshold to prevent exploding gradients.
Value parameters
- threshold
-
the threshold value for gradient clipping
Attributes
- Definition Classes
Get the previous hidden state at time step t.
Get the previous hidden state at time step t.
Value parameters
- H
-
The hidden state
- t
-
The time step
Attributes
- Returns
-
The previous hidden state matrix
Update the model parameters based on the gradients. This method applies momentum and updates the parameters using the specified learning rate and batch size.
Update the model parameters based on the gradients. This method applies momentum and updates the parameters using the specified learning rate and batch size.
Value parameters
- batch_size
-
the size of the batch used for training
- leaky
-
a boolean flag indicating whether to use leaky updates (default is true)
Attributes
Zero the gradients of the model parameters. This method sets all gradients of the weight matrices and bias vectors to zero.
Zero the gradients of the model parameters. This method sets all gradients of the weight matrices and bias vectors to zero.
Attributes
Inherited methods
Initialize a bias group with a specified size.
Initialize a bias group with a specified size.
Value parameters
- size
-
the size of the bias vector
Attributes
- Returns
-
A ParamGroup containing the initialized bias vector, velocity vector, and gradient vector
- Inherited from:
- RecurrentBase
Initialize a parameter group with a specified number of rows, columns, and standard deviation.
Initialize a parameter group with a specified number of rows, columns, and standard deviation.
Value parameters
- cols
-
the number of columns in the parameter matrix
- rows
-
the number of rows in the parameter matrix
- stdDev
-
the standard deviation for initializing the parameter matrix
Attributes
- Returns
-
A ParamGroup containing the initialized parameter matrix, velocity matrix, and gradient matrix
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Updates a specific batch of rows in a matrix with new values.
Updates a specific batch of rows in a matrix with new values.
Value parameters
- batch_end
-
the ending index (exclusive) of the batch in the matrix
- batch_start
-
the starting index of the batch in the matrix
- matrix
-
the matrix to be updated
- newBatch
-
the new matrix containing the values to be inserted
Attributes
- Throws
-
IllegalArgumentException
If the size of newBatch doesn't match the specified batch size
- Inherited from:
- RecurrentBase
Inherited and Abstract methods
Abstract method for training the model with the given input and output tensors.
Abstract method for training the model with the given input and output tensors.
Value parameters
- x
-
the input tensor
- y
-
the output tensor
Attributes
- Inherited from:
- RecurrentBase
Concrete fields
Inherited fields
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Inherited and Abstract fields
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase
Attributes
- Inherited from:
- RecurrentBase