diffusion_models.losses.kl_divergence.gaussian_kl

diffusion_models.losses.kl_divergence.gaussian_kl(p_mean, p_var, q_mean, q_var)[source]

Calculate KL Divergence of 2 Gaussian distributions.

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

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

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

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

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

Returns:

KL divergence of inputs

Return type:

out

References