NHiTSBlock#

class pytorch_forecasting.models.nhits.sub_modules.NHiTSBlock(context_length: int, prediction_length: int, output_size: int, encoder_covariate_size: int, decoder_covariate_size: int, static_size: int, static_hidden_size: int, n_theta: int, hidden_size: List[int], pooling_sizes: int, pooling_mode: str, basis: Module, n_layers: int, batch_normalization: bool, dropout: float, activation: str)[source]#

Bases: Module

N-HiTS block which takes a basis function as an argument.

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

Methods

forward(encoder_y, encoder_x_t, decoder_x_t, x_s)

Define the computation performed at every call.

forward(encoder_y: Tensor, encoder_x_t: Tensor, decoder_x_t: Tensor, x_s: Tensor) Tuple[Tensor, 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.