gluonts.torch.model.tft.layers 模块#

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

继承自: gluonts.torch.modules.feature.FeatureEmbedder

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

定义每次调用时执行的计算。

应被所有子类重写。

注意

尽管前向传播的逻辑需要在函数内定义,但后续应该调用 Module 实例而非直接调用此函数,因为前者会处理注册的钩子,而后者会静默忽略它们。

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

继承自: torch.nn.modules.module.Module

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

features – 形状为 (…, sum(self.feature_dims)) 的数值特征。

返回值

投影特征列表,形状为 [(…, self.embedding_dims[i]) for i in self.embedding_dims]

返回类型

projected_features

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

继承自: torch.nn.modules.module.Module

forward(x: torch.Tensor) torch.Tensor[source]#

定义每次调用时执行的计算。

应被所有子类重写。

注意

尽管前向传播的逻辑需要在函数内定义,但后续应该调用 Module 实例而非直接调用此函数,因为前者会处理注册的钩子,而后者会静默忽略它们。

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]#

继承自: torch.nn.modules.module.Module

forward(x: torch.Tensor, c: Optional[torch.Tensor] = None) torch.Tensor[source]#

定义每次调用时执行的计算。

应被所有子类重写。

注意

尽管前向传播的逻辑需要在函数内定义,但后续应该调用 Module 实例而非直接调用此函数,因为前者会处理注册的钩子,而后者会静默忽略它们。

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]#

继承自: torch.nn.modules.module.Module

forward(x: torch.Tensor, static: torch.Tensor, mask: torch.Tensor) torch.Tensor[source]#

定义每次调用时执行的计算。

应被所有子类重写。

注意

尽管前向传播的逻辑需要在函数内定义,但后续应该调用 Module 实例而非直接调用此函数,因为前者会处理注册的钩子,而后者会静默忽略它们。

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

继承自: torch.nn.modules.module.Module

forward(ctx_input: torch.Tensor, tgt_input: Optional[torch.Tensor] = None, states: Optional[List[torch.Tensor]] = None)[source]#

定义每次调用时执行的计算。

应被所有子类重写。

注意

尽管前向传播的逻辑需要在函数内定义,但后续应该调用 Module 实例而非直接调用此函数,因为前者会处理注册的钩子,而后者会静默忽略它们。

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

继承自: torch.nn.modules.module.Module

forward(variables: List[torch.Tensor], static: Optional[torch.Tensor] = None) Tuple[torch.Tensor, torch.Tensor][source]#

定义每次调用时执行的计算。

应被所有子类重写。

注意

尽管前向传播的逻辑需要在函数内定义,但后续应该调用 Module 实例而非直接调用此函数,因为前者会处理注册的钩子,而后者会静默忽略它们。

training: bool#