February 2018
Intermediate to advanced
262 pages
6h 59m
English
We will define a binary cross-entropy loss and two optimizers, one for the generator and another one for the discriminator, in the following code:
criterion = nn.BCELoss()# setup optimizeroptimizerD = optim.Adam(netD.parameters(), lr, betas=(beta1, 0.999))optimizerG = optim.Adam(netG.parameters(), lr, betas=(beta1, 0.999))
Up to this point, it is very similar to what we have seen in all our previous examples. Let's explore how we can train the generator and discriminator.