shredx.modules.cnn.CNNDecoder#

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

Bases: Module

1D convolutional neural network (CNN) decoder.

Creates a convolutional network with logarithmically spaced channel sizes between the input and output dimensions. Uses 1D convolutions with kernel size 3 and padding 1, ReLU activations between intermediate layers, and applies dropout after the final layer.

Parameters:
in_dimint

Input channel dimension of the decoder.

out_dimint

Output channel dimension of the decoder.

n_layersint

Number of convolutional layers in the network.

dropoutfloat

Dropout probability applied after the final layer.

devicestr, optional

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

Methods

forward(x)

Apply the CNN decoder to an input batch.

Notes

Class Methods:

forward(x):

  • Applies the CNN 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.