gluonts.torch.modules.loss module

class gluonts.torch.modules.loss.DistributionLoss[source]

Bases: torch.nn.modules.module.Module

A torch.nn.Module extensions that computes loss values by comparing a Distribution (prediction) to a Tensor (ground-truth).

forward(input: torch.distributions.distribution.Distribution, target: torch.Tensor) → torch.Tensor[source]

Compute the loss of predicting target with the input distribution.

Parameters
  • input – Distribution object representing the prediction.

  • target – Tensor containing the ground truth.

Returns

Tensor containing loss values, with the same shape as target.

Return type

torch.Tensor

Raises

NotImplementedError – [description]

training = None
class gluonts.torch.modules.loss.NegativeLogLikelihood[source]

Bases: gluonts.torch.modules.loss.DistributionLoss

forward(input: torch.distributions.distribution.Distribution, target: torch.Tensor) → torch.Tensor[source]

Compute the loss of predicting target with the input distribution.

Parameters
  • input – Distribution object representing the prediction.

  • target – Tensor containing the ground truth.

Returns

Tensor containing loss values, with the same shape as target.

Return type

torch.Tensor

Raises

NotImplementedError – [description]

training = None