pytagi.nn.slinear#

Classes#

SLinear

Smoother Linear layer for the SLSTM architecture.

Module Contents#

class pytagi.nn.slinear.SLinear(input_size: int, output_size: 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

Smoother Linear layer for the SLSTM architecture.

This layer performs a linear transformation (\(y = xW^T + b'), specifically designed to be used within SLSTM where a hidden- and cell-state smoothing through time is applied. It wraps the C++/CUDA backend `cutagi.SLinear\).

Initializes the SLinear layer.

Parameters:
  • input_size (int) – The number of input features.

  • output_size (int) – The number of output features.

  • bias (bool) – If True, adds a learnable bias to the output.

  • 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 information about the layer’s configuration (sizes, bias, etc.).

get_layer_name() str[source]#

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

init_weight_bias()[source]#

Initializes the layer’s weight matrix and bias vector based on the configured method.