Here is the code you can use to train a deep convolutional GAN DCGAN for generating realistic images:
In the above code we are using Generator & Discriminator where both networks are defined using ConvTranspose2d for the generator and Conv2d for the discriminator, Loss: which uses BCELoss for binary classification between real and fake images and Training to train the discriminator and generator alternately, updating their weights with the Adam optimizer.
Hence, this script trains a DCGAN model to generate realistic images (e.g., CIFAR-10) with basic architectures.