Skip to content

Commit

Permalink
Add arXiv link to VAE paper
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaskoepf authored Jan 18, 2017
1 parent f39536f commit 2c7b523
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vae/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def forward(self, x):
def loss_function(recon_x, x, mu, logvar):
BCE = reconstruction_function(recon_x, x)

# Appendix B from VAE paper: 0.5 * sum(1 + log(sigma^2) - mu^2 - sigma^2)
# see Appendix B from VAE paper:
# Kingma and Welling. Auto-Encoding Variational Bayes. ICLR, 2014
# https://arxiv.org/abs/1312.6114
# 0.5 * sum(1 + log(sigma^2) - mu^2 - sigma^2)
KLD_element = mu.pow(2).add_(logvar.exp()).mul_(-1).add_(1).add_(logvar)
KLD = torch.sum(KLD_element).mul_(-0.5)

Expand Down

0 comments on commit 2c7b523

Please sign in to comment.