DCGANGenerator#

class deepinv.models.DCGANGenerator(output_size: int = 64, nz: int = 100, ngf: int = 64, nc: int = 3)[source]#

Bases: Module

DCGAN Generator.

The DCGAN generator model was originally proposed in Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks (Radford et al.) and takes a latent sample as input.

Implementation taken from https://pytorch.org/tutorials/beginner/dcgan_faces_tutorial.html

See Imaging inverse problems with adversarial networks for how to use this for adversarial training.

Parameters:
  • output_size (int) – desired square size of output image. Choose from 64 or 128, defaults to 64

  • nz (int) – latent dimension, defaults to 100

  • ngf (int) – hidden layer size, defaults to 64

  • nc (int) – number of image output channels, defaults to 3

forward(input, *args, **kwargs)[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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Examples using DCGANGenerator:#

Imaging inverse problems with adversarial networks

Imaging inverse problems with adversarial networks