In this week’s lab, I’m having trouble defining the DCGAN discriminator block as described in the instructions:
# Steps:
# 1) Add a convolutional layer using the given parameters.
# 2) Do a batchnorm, except for the last layer.
# 3) Follow each batchnorm with a LeakyReLU activation with slope 0.2.
# Note: Don't use an activation on the final layer
# Build the neural block
if not final_layer:
return nn.Sequential(
#### START CODE HERE #### #
nn.Conv2d(input_channels, output_channels, kernel_size, stride=stride),
nn.BatchNorm2d(output_channels),
nn.LeakyReLU(0.2)
#### END CODE HERE ####
)
else: # Final Layer
return nn.Sequential(
#### START CODE HERE #### #
nn.Conv2d(input_channels, output_channels, kernel_size, stride=stride)
#### END CODE HERE ####
)
Can someone point out where I went wrong? The instructions seemed very straightforward.