diffusion_models.losses.kl_divergence.log_gaussian_kl

diffusion_models.losses.kl_divergence.log_gaussian_kl(p_mean, p_logvar, q_mean, q_logvar)[source]

Calculate KL Divergence of 2 Gaussian distributions.

KL divergence between two univariate Gaussians, as derived in [1], with k=1 (dimensionality) and log variances.

Parameters:
  • p_mean (Tensor, '1')) – mean value of first distribution

  • p_logvar (Tensor, '1')) – log of variance value of first distribution

  • q_mean (Tensor, '1')) – mean value of second distribution

  • q_logvar (Tensor, '1')) – log of variance value of second distribution

Returns:

KL divergence of inputs

Return type:

out

References