February 2018
Intermediate to advanced
262 pages
6h 59m
English
We looked at individual pieces of how a GAN is trained. Let's summarize them as follows and look at the complete code that will be used to train the GAN network we created:
We will use the following code to train the network:
for epoch in range(niter): for i, data in enumerate(dataloader, 0): ############################ # (1) Update D network: maximize log(D(x)) + log(1 - D(G(z))) ########################### # train with real netD.zero_grad() real, _ = data batch_size = real.size(0) if torch.cuda.is_available(): ...
Read now
Unlock full access