nnsvs.mdn.mdn_loss

nnsvs.mdn.mdn_loss(log_pi, log_sigma, mu, target, log_pi_min=-7.0, log_sigma_min=-7.0, reduce=True)[source]

Calculates the error, given the MoG parameters and the target. The loss is the negative log likelihood of the data given the MoG parameters.

Parameters:
  • log_pi (torch.Tensor) – Tensor of shape (B, T, G) or (B, T, G, D_out) The log of multinomial distribution of the Gaussians. B is the batch size, T is data length of this batch, and G is num_gaussians of class MDNLayer.

  • log_sigma (torch.Tensor) – Tensor of shape (B, T, G ,D_out) The log standard deviation of the Gaussians. D_out is out_dim of class MDNLayer.

  • mu (torch.Tensor) – Tensor of shape (B, T, G, D_out) The means of the Gaussians.

  • target (torch.Tensor) – Tensor of shape (B, T, D_out) The target variables.

  • log_pi_min (float) – Minimum value of log_pi (for numerical stability)

  • log_sigma_min (float) – Minimum value of log_sigma (for numerical stability)

  • reduce – If True, the losses are averaged for each batch.

Returns:

Negative Log Likelihood of Mixture Density Networks.

Return type:

loss (B) or (B, T)