Defining the generator and discriminator networks
As mentioned earlier, GANs are composed of two components – the generator and the discriminator. Both of these are essentially neural networks. Generators and discriminators with different neural architectures produce different types of GANs. You can find a list of different types of GANs along with their PyTorch implementations in this reference list [1].
For any GAN that is used to generate some kind of real data, the generator usually takes random noise as input and produces an output with the same dimensions as the real data. We call this generated output fake data. The discriminator, on the other hand, works as a binary classifier. It takes in the generated fake data and the real data (one at a time) as input and predicts whether the input data is real or fake. Figure 9.1 shows a diagram of the overall GAN model schematic:
Figure 9.1: A GAN schematic
The discriminator network is optimized like any binary...