Skip to content

Commit

Permalink
updating KLD function
Browse files Browse the repository at this point in the history
  • Loading branch information
dev4488 committed Sep 4, 2018
1 parent dd931d8 commit 798d481
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vae_gumbel_softmax.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def loss_function(recon_x, x,qy):

log_qy = torch.log(qy+1e-20)
g = Variable(torch.log(torch.Tensor([1.0/categorical_dim])).cuda())
KLD = -torch.sum(qy*(log_qy - g))
KLD = torch.sum(qy*(log_qy - g),dim=-1).mean()

return BCE + KLD

Expand Down

0 comments on commit 798d481

Please sign in to comment.