Last active
February 27, 2020 16:11
-
-
Save harsh-99/c0e9fdeaa320c9e4a52f58c4d74a2cee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#To train the Discriminator | |
output_d_real = discriminator(real_images) | |
d_real_loss = criterion(output_d_real, real_labels) | |
z = torch.randn(batch_size, random_size).to(device) | |
fake_images = generator(z) | |
output_d_fake = discriminator(fake_images) | |
d_fake_loss = criterion(output_d_fake, fake_labels) | |
d_loss = d_real_loss + d_fake_loss | |
optimizer_d.zero_grad() | |
d_loss.backward() | |
optimizer_d.step()#this is going to update only parameters of discriminator |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment