Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some question of KLD #3

Open
CXX1113 opened this issue Apr 7, 2019 · 3 comments
Open

Some question of KLD #3

CXX1113 opened this issue Apr 7, 2019 · 3 comments

Comments

@CXX1113
Copy link

CXX1113 commented Apr 7, 2019

KLD = -0.5 / n_nodes * torch.mean(torch.sum(1 + 2 * logvar - mu.pow(2) - logvar.exp().pow(2), 1))
/ n_nodes should be removed or
torch.mean → torch.sum

@AllenWu18
Copy link

then is it should be
KLD = -0.5 * torch.mean(torch.sum(1 + 2 * logvar - mu.pow(2) - logvar.exp().pow(2), 1))
or
KLD = -0.5 / n_nodes * torch.sum(torch.sum(1 +2 * logvar - mu.pow(2)-logvar.exp().pow(2) , 1))?

@YH-UtMSB
Copy link

YH-UtMSB commented Aug 26, 2019

@alanlisten @AllenWu18 you both are right about the KLD. The author has clarified that 1 / n_nodes serves as a rescaling parameter (like \beta in beta-vae) to weaken the regularization from KLD. Check this issue: Loss function in optimizer.py #20.

@Dzhilin
Copy link

Dzhilin commented Jul 19, 2021

Please tell me what is the meaning of "norm" in the loss function? Looking forward to your reply!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants