Last active
February 27, 2020 16:06
-
-
Save harsh-99/802ae7af38c77743ecdb48d75ac3d037 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 generator | |
# Input to generator is a noise of size random_size | |
z = torch.randn(batch_size, random_size) | |
output_image = generator(z) | |
output_discriminator = discriminator(output_image) | |
#to train the generator the output of this should be compared with real_labels. | |
#so we compare the output by real label. | |
#criterion -> BCE Loss | |
g_loss = criterion(outputs, real_labels) | |
optimizer_g.zero_grad() | |
g_loss.backward() | |
optimizer_g.step() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment