shredx.modules.mlp.MLPDecoder#

class shredx.modules.mlp.MLPDecoder(in_dim: int, out_dim: int, n_layers: int, dropout: float, device: str = 'cpu')#

Bases: Module

Multi-Layer Perceptron (MLP) decoder.

Creates a feedforward neural network with logarithmically spaced layer sizes between the input and output dimensions. Uses ReLU activations between intermediate layers and applies dropout after the final layer.

Parameters:
in_dimint

Input feature dimension of the decoder.

out_dimint

Output feature dimension of the decoder.

n_layersint

Number of linear layers in the network.

dropoutfloat

Dropout probability applied after the final layer.

devicestr, optional

Device on which to place the model. Default is "cpu".

Methods

forward(x)

Apply the MLP decoder to an input batch.

Notes

Class Methods:

forward(x):

  • Applies the MLP decoder to an input batch.

  • Parameters:
    • x : Float[torch.Tensor, “batch forecast_length sequence_length hidden_dim”]. Input tensor.

  • Returns:
    • tuple. Tuple containing the decoded tensor of shape and None for no auxiliary losses.