kaira.models.components.MLPDecoder

Inheritance diagram of MLPDecoder

Inheritance diagram for MLPDecoder

class kaira.models.components.MLPDecoder(in_features: int, out_features: int, hidden_dims: List[int] | None = None, activation: Module | None = None, output_activation: Module | None = None, *args: Any, **kwargs: Any)[source]

Bases: BaseModel

Multi-Layer Perceptron (MLP) Decoder for communication systems.

This module implements a simple MLP-based decoder that maps received signals back to their corresponding messages.

Methods

__init__

Initialize the MLPDecoder.

forward

Forward pass of the MLPDecoder.

__init__(in_features: int, out_features: int, hidden_dims: List[int] | None = None, activation: Module | None = None, output_activation: Module | None = None, *args: Any, **kwargs: Any)[source]

Initialize the MLPDecoder.

Parameters:
  • in_features (int) – The dimensionality of the input received signals.

  • out_features (int) – The dimensionality of the output decoded messages.

  • hidden_dims (List[int], optional) – Dimensions of hidden layers. If None, a single hidden layer with (in_features + out_features) // 2 units is used.

  • activation (nn.Module, optional) – Activation function to use between layers. If None, ReLU is used.

  • output_activation (nn.Module, optional) – Activation function to use at the output. If None, no activation is applied to the output.

  • *args – Variable positional arguments passed to the base class.

  • **kwargs – Variable keyword arguments passed to the base class.

forward(x: Tensor, *args: Any, **kwargs: Any) Tensor[source]

Forward pass of the MLPDecoder.

Parameters:
  • x (torch.Tensor) – Input tensor of shape (batch_size, in_features).

  • *args – Additional positional arguments (unused).

  • **kwargs – Additional keyword arguments (unused).

Returns:

Output tensor of shape (batch_size, out_features).

Return type:

torch.Tensor