The VAE objective includes a KL term that pulls each posterior toward a standard normal prior. This keeps the latent space smooth, so random samples from the prior decode to plausible data.
Implement kl_std_normal(mu, logvar), the KL from a diagonal Gaussian to the standard normal, summed over dimensions.
Use -0.5 * sum(1 + logvar - mu^2 - exp(logvar)).
No results yet
Run your code to check it against the examples, or submit to run every test.