pytagi.nn.slstm#

Classes#

SLSTM

Smoothing Long Short-Term Memory (LSTM) layer.

Module Contents#

class pytagi.nn.slstm.SLSTM(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

Smoothing Long Short-Term Memory (LSTM) layer.

This layer is a variation of the standard LSTM, incorporating a mechanism for smoothing the hidden- and cell-states. It wraps the C++/CUDA backend cutagi.SLSTM.

Initializes the SLSTM layer.

Parameters:
  • input_size (int) – The number of expected features in the input $x$.

  • output_size (int) – The number of features in the hidden state $h$ (and the output).

  • seq_len (int) – The maximum sequence length this layer is configured to handle.

  • bias (bool) – If True, use bias weights in the internal linear transformations.

  • gain_weight (float) – A scaling factor applied to the initialized weights.

  • gain_bias (float) – A scaling factor applied to the initialized bias terms.

  • init_method (str) – The method used for initializing weights and biases (e.g., ‘He’, ‘Xavier’).

get_layer_info() str[source]#

Returns a string containing detailed information about the layer’s configuration.

get_layer_name() str[source]#

Returns the name of the layer (e.g., ‘SLSTM’).

init_weight_bias()[source]#

Initializes all the layer’s internal weight matrices and bias vectors (for gates and cell) based on the configured method.