Building The Discriminator

Learn to build the discriminator class and define the network architecture and functions forward() and train().

The Discriminator class

Let’s code the discriminator. Just like before, it is a neural network with a class inherited from nn.Module. We follow the expected PyTorch patterns for initializing the network and providing a forward() function.

Have a look at the following constructor for a Discriminator class.

Get hands-on with 1200+ tech skills courses.