pytagi.nn.lstm#
Classes#
A Long Short-Term Memory (LSTM) layer for RNNs. It inherits from BaseLayer. |
Module Contents#
- class pytagi.nn.lstm.LSTM(input_size: int, output_size: int, seq_len: int, bias: bool = True, gain_weight: float = 1.0, gain_bias: float = 1.0, init_method: str = 'He')[source]#
Bases:
pytagi.nn.base_layer.BaseLayer
A Long Short-Term Memory (LSTM) layer for RNNs. It inherits from BaseLayer.
Initializes the LSTM layer.
- Parameters:
input_size – The number of features in the input tensor at each time step.
output_size – The size of the hidden state (\(h_t\)), which is the number of features in the output tensor at each time step.
seq_len – The maximum length of the input sequence. This is often required for efficient memory allocation in C++/CUDA backends like cuTAGI.
bias – If True, the internal gates and cell state updates will include an additive bias vector. Defaults to True.
gain_weight – Scaling factor applied to the initialized weights (\(W\)). Defaults to 1.0.
gain_bias – Scaling factor applied to the initialized biases (\(b\)). Defaults to 1.0.
init_method – The method used for initializing the weights and biases (e.g., “He”, “Xavier”). Defaults to “He”.