Skip to content

Commit 9eb2594

Browse files
authored
Update dcgan_faces_tutorial.py
1 parent c28fb28 commit 9eb2594

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

beginner_source/dcgan_faces_tutorial.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -610,10 +610,7 @@ def forward(self, input):
610610
output = netD(fake.detach()).view(-1)
611611
# Calculate D's loss on the all-fake batch
612612
errD_fake = criterion(output, label)
613-
# Calculate the gradients for this batch
614-
# Without a zero_grad() call, this accumulates (sums)
615-
# the gradients from this call with the previously computed
616-
# gradients from errD_real
613+
# Calculate the gradients for this batch, accumulated (summed) with previous gradients
617614
errD_fake.backward()
618615
D_G_z1 = output.mean().item()
619616
# Compute error of D as sum over the fake and the real batches

0 commit comments

Comments
 (0)