Evolvable Long Short-Term Memory (LSTM)¶
Parameters¶
- class agilerl.modules.lstm.EvolvableLSTM(*args: Any, **kwargs: Any)¶
The Evolvable Long Short-Term Memory (LSTM) class.
- Parameters:
input_size (int) – Size of input features
hidden_state_size (int) – Size of hidden state
num_outputs (int) – Output dimension
num_layers (int) – Number of LSTM layers stacked together
output_activation (str, optional) – Output activation layer, defaults to None
min_hidden_state_size (int, optional) – Minimum hidden state size, defaults to 32
max_hidden_state_size (int, optional) – Maximum hidden state size, defaults to 512
min_layers (int, optional) – Minimum number of LSTM layers, defaults to 1
max_layers (int, optional) – Maximum number of LSTM layers, defaults to 3
dropout (float, optional) – Dropout probability between LSTM layers, defaults to 0.0
device (str, optional) – Device for accelerated computing, ‘cpu’ or ‘cuda’, defaults to ‘cpu’
name (str, optional) – Name of the network, defaults to ‘lstm’
random_seed (int | None) – Random seed to use for the network. Defaults to None.
- change_activation(activation: str, output: bool = False) None¶
Set the output activation function for the network.
- create_lstm() ModuleDict¶
Create and returns an LSTM network with the current configuration.
- Returns:
LSTM network
- Return type:
nn.ModuleDict
- forward(x: ndarray | Tensor, hidden_state: dict[str, ndarray | Tensor] | None = None) tuple[Tensor, dict[str, Tensor]]¶
Forward pass of the network.
- get_output_dense() Module¶
Return output layer of neural network.
Return the hidden state architecture.