EncoderLayer#

class pytorch_forecasting.models.timexer.sub_modules.EncoderLayer(self_attention, cross_attention, d_model, d_ff=None, dropout=0.1, activation='relu')[source]#

Bases: Module

Encoder layer for the TimeXer model. :param self_attention: Self-attention mechanism. :type self_attention: nn.Module :param cross_attention: Cross-attention mechanism. :type cross_attention: nn.Module :param d_model: Dimension of the model. :type d_model: int :param d_ff: Dimension of the feedforward layer. Defaults to 4 * d_model. :type d_ff: int, optional :param dropout: Dropout rate. Defaults to 0.1. :type dropout: float :param activation: Activation function. Defaults to “relu”. :type activation: str

Initialize internal Module state, shared by both nn.Module and ScriptModule.

Methods

forward(x, cross[, x_mask, cross_mask, tau, ...])

Define the computation performed at every call.

forward(x, cross, x_mask=None, cross_mask=None, tau=None, delta=None)[source]#

Define the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.