jmandivarapu1:

Firstly I am not pretty sure bout your conclusion that “Pytorch architecture doesn’t use the whole train/test idea mentioned by Kingma” because pytorch version runs for 10 epochs and 128 batch size each and it use the complete dataset for 10 epochs.


What I meant was that in the Pytorch VAE code they use the reparam trick, ie z=mean + eps*logvar, during train AND test (instead of that during train and z=eps during test) - or am I missing something?
So is the code below a correct replacement for reparam during test (so basically correct sampling)? I’m returning z=eps (so N(0,1)) and I guess the mean&logvar should be calculated like before? (and then used for KL divergence)
def test_reparam(self, h): 
   mean, logvar = self.fc1a(h), self.fc1b(h) 
   std_dev = torch.exp(0.5*logvar) 
   eps = torch.randn_like(std_dev) 
   z = eps # z is now eps (norm dist) 
   return z, mean, logvar

Thanks