From 06b7ba1618e1ae71ecfeacc748a5c1d3fb18b98e Mon Sep 17 00:00:00 2001 From: Christopher Yeh Date: Wed, 28 Nov 2018 15:53:37 -0800 Subject: [PATCH] Sample z from N(0,1) instead of interval [0, 1) VAE formulation has prior p(z) = N(z | mu=0, std=1) --- solver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solver.py b/solver.py index 7d65766..febab3e 100644 --- a/solver.py +++ b/solver.py @@ -358,7 +358,7 @@ def viz_traverse(self, limit=3, inter=2/3, loc=-1): random_img = Variable(cuda(random_img, self.use_cuda), volatile=True).unsqueeze(0) random_img_z = encoder(random_img)[:, :self.z_dim] - random_z = Variable(cuda(torch.rand(1, self.z_dim), self.use_cuda), volatile=True) + random_z = Variable(cuda(torch.randn(1, self.z_dim), self.use_cuda), volatile=True) if self.dataset == 'dsprites': fixed_idx1 = 87040 # square