MCPcopy Create free account
hub / github.com/Zhiyuan-R/Tiger-Diffusion / normal_kl

Function normal_kl

test_generation.py:23–28  ·  view source on GitHub ↗

KL divergence between normal distributions parameterized by mean and log-variance.

(mean1, logvar1, mean2, logvar2)

Source from the content-addressed store, hash-verified

21models
22'''
23def normal_kl(mean1, logvar1, mean2, logvar2):
24 """
25 KL divergence between normal distributions parameterized by mean and log-variance.
26 """
27 return 0.5 * (-1.0 + logvar2 - logvar1 + torch.exp(logvar1 - logvar2)
28 + (mean1 - mean2)**2 * torch.exp(-logvar2))
29
30def discretized_gaussian_log_likelihood(x, *, means, log_scales):
31 # Assumes data is integers [0, 1]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected