GAN_MNIST_torch module
- class GAN_MNIST_torch.Discriminator_MNIST[source]
Bases:
ModuleUnconditional Discriminator model for MNIST dataset.
- Input:
x (Tensor): Input MNIST image of shape (BATCH, 1, 28, 28).
- Output:
Tensor: Discriminator output scalar for each image in the batch.
- forward(x)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class GAN_MNIST_torch.Discriminator_MNIST_cond[source]
Bases:
ModuleConditional Discriminator model for MNIST dataset.
- Input:
x (Tensor): Input MNIST image of shape (BATCH, 1, 28, 28). z (Tensor): One-hot encoded label tensor of shape (BATCH, 10).
- Output:
Tensor: Discriminator output scalar for each image in the batch.
- forward(x, z)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class GAN_MNIST_torch.Generator_MNIST(latent_dim=118)[source]
Bases:
ModuleUnconditional Generator model for MNIST dataset.
- Parameters:
latent_dim (int) – Dimension of the latent input vector. Default is 118.
- Input:
BATCH (int): Batch size for random latent vector generation. Default is 16.
- Output:
Tensor: Generated image of shape (BATCH, 1, 28, 28).
- forward(BATCH=16)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class GAN_MNIST_torch.Generator_MNIST_cond(latent_dim=118)[source]
Bases:
ModuleConditional Generator model for MNIST dataset.
- Parameters:
latent_dim (int) – Dimension of the latent input vector. Default is 118.
- forward(label, BATCH=16)[source]
Generates an image conditioned on the input label and a random noise vector.
- Input:
label (Tensor): One-hot encoded label tensor of shape (BATCH, 10). BATCH (int): Batch size for random latent vector generation. Default is 16.
- Output:
Tensor: Generated image of shape (BATCH, 1, 28, 28).
- forward(label, BATCH=16)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.