Skip to content

Commit e11e079

Browse files
JustinShenksoumith
authored andcommitted
Fix indentation to be self-consistent (#279)
* Fix indentation to be self-consistent Replace 2-space with 4-space indentation * Fix indentation to be self-consistent Replace 2-space with 4-space indentation * Fix indentation Replace 3-space indentation with 4-space indentation
1 parent e23a9b4 commit e11e079

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vae/main.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ def encode(self, x):
5858

5959
def reparameterize(self, mu, logvar):
6060
if self.training:
61-
std = logvar.mul(0.5).exp_()
62-
eps = Variable(std.data.new(std.size()).normal_())
63-
return eps.mul(std).add_(mu)
61+
std = logvar.mul(0.5).exp_()
62+
eps = Variable(std.data.new(std.size()).normal_())
63+
return eps.mul(std).add_(mu)
6464
else:
65-
return mu
65+
return mu
6666

6767
def decode(self, z):
6868
h3 = self.relu(self.fc3(z))
@@ -129,10 +129,10 @@ def test(epoch):
129129
recon_batch, mu, logvar = model(data)
130130
test_loss += loss_function(recon_batch, data, mu, logvar).data[0]
131131
if i == 0:
132-
n = min(data.size(0), 8)
133-
comparison = torch.cat([data[:n],
132+
n = min(data.size(0), 8)
133+
comparison = torch.cat([data[:n],
134134
recon_batch.view(args.batch_size, 1, 28, 28)[:n]])
135-
save_image(comparison.data.cpu(),
135+
save_image(comparison.data.cpu(),
136136
'results/reconstruction_' + str(epoch) + '.png', nrow=n)
137137

138138
test_loss /= len(test_loader.dataset)
@@ -144,7 +144,7 @@ def test(epoch):
144144
test(epoch)
145145
sample = Variable(torch.randn(64, 20))
146146
if args.cuda:
147-
sample = sample.cuda()
147+
sample = sample.cuda()
148148
sample = model.decode(sample).cpu()
149149
save_image(sample.data.view(64, 1, 28, 28),
150150
'results/sample_' + str(epoch) + '.png')

0 commit comments

Comments
 (0)