gluonts.torch.model.tft.layers module#

class gluonts.torch.model.tft.layers.FeatureEmbedder(cardinalities: List[int], embedding_dims: List[int])[source]#

Bases: gluonts.torch.modules.feature.FeatureEmbedder

forward(features: torch.Tensor) List[torch.Tensor][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.

training: bool#
class gluonts.torch.model.tft.layers.FeatureProjector(feature_dims: List[int], embedding_dims: List[int], **kwargs)[source]#

Bases: torch.nn.modules.module.Module

forward(features: torch.Tensor) List[torch.Tensor][source]#
Parameters

features – Numerical features with shape (…, sum(self.feature_dims)).

Returns

List of project features, with shapes [(…, self.embedding_dims[i]) for i in self.embedding_dims]

Return type

projected_features

training: bool#
class gluonts.torch.model.tft.layers.GatedLinearUnit(dim: int = - 1, nonlinear: bool = True)[source]#

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor) torch.Tensor[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.

training: bool#
class gluonts.torch.model.tft.layers.GatedResidualNetwork(d_hidden: int, d_input: Optional[int] = None, d_output: Optional[int] = None, d_static: Optional[int] = None, dropout: float = 0.0)[source]#

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor, c: Optional[torch.Tensor] = None) torch.Tensor[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.

training: bool#
class gluonts.torch.model.tft.layers.TemporalFusionDecoder(context_length: int, prediction_length: int, d_hidden: int, d_var: int, num_heads: int, dropout: float = 0.0)[source]#

Bases: torch.nn.modules.module.Module

forward(x: torch.Tensor, static: torch.Tensor, mask: torch.Tensor) torch.Tensor[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.

training: bool#
class gluonts.torch.model.tft.layers.TemporalFusionEncoder(d_input: int, d_hidden: int)[source]#

Bases: torch.nn.modules.module.Module

forward(ctx_input: torch.Tensor, tgt_input: Optional[torch.Tensor] = None, states: Optional[List[torch.Tensor]] = 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.

training: bool#
class gluonts.torch.model.tft.layers.VariableSelectionNetwork(d_hidden: int, num_vars: int, dropout: float = 0.0, add_static: bool = False)[source]#

Bases: torch.nn.modules.module.Module

forward(variables: List[torch.Tensor], static: Optional[torch.Tensor] = None) Tuple[torch.Tensor, torch.Tensor][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.

training: bool#