class_docstr: Implements a basic GAN for the purpose of illustrating multiple optimizers.
code: def __init__(
      self,
      hidden_dim: int = 128,
      learning_rate: float = 0.001,
      b1: float = 0.5,
      b2: float = 0.999,
      **kwargs,
  ):
      super().__init__()
      self.automatic_optimization = False
      self.hidden_dim = hidden_dim
      self.learning_rate = learning_rate
      self.b1 = b1
      self.b2 = b2
  
      # networks
      mnist_shape = (1, 28, 28)
      self.generator = Generator(
          latent_dim=self.hidden_dim, img_shape=mnist_shape
      )
      self.discriminator = Discriminator(img_shape=mnist_shape)
  
      # cache for generated images
      self.generated_imgs = None
      self.last_imgs = None
  
      self.example_input_array = torch.rand(2, self.hidden_dim)
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from lightning.pytorch.core.module import LightningModule
  from torch.utils.data import DataLoader
  from tests_pytorch import _PATH_DATASETS
  from tests_pytorch.helpers.datasets import MNIST, AverageDataset, TrialMNIST
label_desc: Use image node_id 1 to create a new BasicGAN object from inherited base classes: LightningModule with example: obj = BasicGAN(hidden_dim, learning_rate, b1, b2)