can we calculate KL divergence of VampPrior and posterior without sampling?
ShellingFord221 opened this issue · 0 comments
ShellingFord221 commented
Hi, in line 78~80 of VAE.py, when calculating the KL divergence of VampPrior p(z) and posterior q(z|x), we put z_q
into N(z_p_mean, z_p_logvar)
and N(z_q_mean, z_q_logvar)
then calculate the difference of log outputs of two Gaussian function.
Line 78 in bb6ff3e
Line 79 in bb6ff3e
Line 80 in bb6ff3e
Since we have already get mean and variance of prior and posterior, can we directly calculate KL divergence of two Gaussian distribution? i.e.
This is because in line 226, z_q
is just drawn from N(z_q_mean, z_q_logvar)
:
Line 226 in bb6ff3e
So can we skip this step? Thanks!