shredx.models.mixed_model.MixedModel#

class shredx.models.mixed_model.MixedModel(encoder: Module, decoder: Module)#

Bases: Module

A flexible encoder-decoder model supporting multiple encoder and decoder types.

Combines various encoder architectures (RNNs, Transformers) with decoder architectures (MLP, CNN) based on configuration arguments.

Parameters:
encodernn.Module

The encoder module to use.

decodernn.Module

The decoder module to use.

Methods

forward(src)

Apply the encoder then decoder to an input batch.

Returns:
nn.Module: A mixed model with the specified encoder and decoder.

Notes

Class Methods:

forward(x):

  • Applies the encoder then decoder to an input batch.

  • Parameters:
    • x : Float[torch.Tensor, "batch sequence input_size"]. Input tensor.

  • Returns:
    • tuple. Tuple containing the final output tensor of shape (batch_size, forecast_length, sequence_length, out_dim) and a dictionary of auxiliary losses.