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. For example, DCGANs purely have CNNs as the generator and discriminator. You can find a list of different types of GANs along with their PyTorch implementations at https://github.com/eriklindernoren/PyTorch-GAN.
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 8.1 shows a diagram of the overall GAN model schematic:
...