DCGANGenerator#
- class deeplay.models.generators.dcgan.DCGANGenerator(*args, **kwargs)#
Bases:
ConvolutionalDecoder2dDeep Convolutional Generative Adversarial Network (DCGAN) generator.
Parameters#
- latent_dim: int
Dimension of the latent space
- feature_dims: int
Dimension of the features. The number of features in the four ConvTransposeBlocks of the Generator can be controlled by this parameter. Convolutional transpose layers = [features_dim*16, features_dim*8, features_dim*4, features_dim*2].
- output_channels: int
Number of output channels
- class_conditioned_model: bool
Whether the model is class-conditional
- embedding_dim: int
Dimension of the label embedding
- num_classes: int
Number of classes
Shorthands#
input: .blocks[0]
hidden: .blocks[:-1]
output: .blocks[-1]
layer: .blocks.layer
activation: .blocks.activation
Constraints#
input shape: (batch_size, latent_dim)
output shape: (batch_size, ch_out, 64, 64)
Examples#
>>> generator = DCGANGenerator(latent_dim=100, output_channels=1, class_conditioned_model=False) >>> generator.build() >>> batch_size = 16 >>> input = torch.randn([batch_size, 100, 1, 1]) >>> output = generator(x=input, y=None)
Return Values#
The forward method returns the processed tensor.
Methods Summary
forward(x[, y])Define the computation performed at every call.
Methods Documentation
- forward(x, y=None)#
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.