aladdinpersson/Machine-Learning-Collection

ConvBlock for Discriminator

Rainyryan opened this issue · 0 comments

In the original paper Upsample is done prior to the convolutions in the Generator, while Downsample is done after the convolutions within the ConvBlock.

I believe the following changes should be appropriate.

I discovered large discrepancies when checking the number of parameters for each layer in D and G. Unlike in the paper where D and G have same number of parameters.

class ConvBlock(nn.Module):
    def __init__(self, in_channels, out_channels, use_pixelnorm=True, isgen=True):
        super(ConvBlock, self).__init__()
        self.use_pn = use_pixelnorm
        self.conv1 = WSConv2d(
            in_channels, out_channels if isgen else in_channels) <<<<<<<<
        self.conv2 = WSConv2d(
            out_channels if isgen else in_channels, out_channels)<<<<<<<<
        self.leaky = nn.LeakyReLU(0.2)
        self.pn = PixelNorm()