# chainerx.gaussian_kl_divergence¶

chainerx.gaussian_kl_divergence()

Element-wise KL-divergence of Gaussian variables from the standard one.

Given two variable mean representing $$\mu$$ and ln_var representing $$\log(\sigma^2)$$, this function calculates the element-wise KL-divergence between the given multi-dimensional Gaussian $$N(\mu, S)$$ and the standard Gaussian $$N(0, I)$$

$D_{\mathbf{KL}}(N(\mu, S) \| N(0, I)),$

where $$S$$ is a diagonal matrix such that $$S_{ii} = \sigma_i^2$$ and $$I$$ is an identity matrix.

Parameters
• mean (ndarray) – A variable representing mean of given gaussian distribution, $$\mu$$.

• ln_var (ndarray) – A variable representing logarithm of variance of given gaussian distribution, $$\log(\sigma^2)$$.

Returns

A variable representing KL-divergence between given gaussian distribution and the standard gaussian.

Return type

ndarray