gluonts.torch.modules.scaler module

class gluonts.torch.modules.scaler.MeanScaler(dim: int, keepdim: bool = False, minimum_scale: float = 1e-10)[source]

Bases: torch.nn.modules.module.Module

Computes a scaling factor as the weighted average absolute value along dimension dim, and scales the data accordingly.

Parameters
  • dim – dimension along which to compute the scale

  • keepdim – controls whether to retain dimension dim (of length 1) in the scale tensor, or suppress it.

  • minimum_scale – default scale that is used for elements that are constantly zero along dimension dim.

forward(data: torch.Tensor, weights: torch.Tensor) → Tuple[torch.Tensor, torch.Tensor][source]

Defines 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 = None
class gluonts.torch.modules.scaler.NOPScaler(dim: int, keepdim: bool = False)[source]

Bases: torch.nn.modules.module.Module

Assigns a scaling factor equal to 1 along dimension dim, and therefore applies no scaling to the input data.

Parameters
  • dim – dimension along which to compute the scale

  • keepdim – controls whether to retain dimension dim (of length 1) in the scale tensor, or suppress it.

forward(data: torch.Tensor, observed_indicator: torch.Tensor) → Tuple[torch.Tensor, torch.Tensor][source]

Defines 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 = None