Skip to Content
Deep Learning with PyTorch
book

Deep Learning with PyTorch

by Vishnu Subramanian
February 2018
Intermediate to advanced
262 pages
6h 59m
English
Packt Publishing
Content preview from Deep Learning with PyTorch

Training the discriminator with real images

Let's pass some real images as ground truth to train discriminator.

First, we will take a look at the code for doing the same and then explore the important features:

output = netD(inputv)errD_real = criterion(output, labelv)errD_real.backward()

In the previous code, we are calculating the loss and the gradients required for the discriminator image. The inputv and labelv represent the input image from the CIFAR10 dataset and labels, which is one for real images. It is pretty straightforward, as it is similar to what we do for other image classifier networks.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Deep Learning with PyTorch

Deep Learning with PyTorch

Eli Stevens, Thomas Viehmann, Luca Pietro Giovanni Antiga
Grokking Deep Learning

Grokking Deep Learning

Andrew W. Trask

Publisher Resources

ISBN: 9781788624336Supplemental Content