FullAttention#
- class pytorch_forecasting.models.timexer.sub_modules.FullAttention(mask_flag=True, factor=5, scale=None, attention_dropout=0.1, output_attention=False)[source]#
Bases:
ModuleFull attention mechanism with optional masking and dropout. :param mask_flag: Whether to apply masking. :type mask_flag: bool :param factor: Factor for scaling the attention scores. :type factor: int :param scale: Scaling factor for attention scores. :type scale: float :param attention_dropout: Dropout rate for attention scores. :type attention_dropout: float :param output_attention: Whether to output attention weights. :type output_attention: bool
Initialize internal Module state, shared by both nn.Module and ScriptModule.
Methods
forward(queries, keys, values, attn_mask[, ...])Define the computation performed at every call.
- forward(queries, keys, values, attn_mask, 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
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.