GANs/Pix2Pix_Isola_et_al_2017/model.py
def make_conv(in_size, out_size, encode, batch_norm, activation, drop_out):
    """Convolutional blocks of the Generator and the Discriminator.

    Let Ck denote a Convolution-BtachNorm-ReLU block with k filters.
    CDk denotes a Convolution-BtachNorm-Dropout-ReLU block with 50% dropout.
    All convolutions are 4 x 4 spatial filters with stride 2. Convolutions in
    the encoder and discriminator downsample by a factor of 2, whereas in the
    decoder they upsample by a factor of 2.
    """
    block = [nn.Conv2d(in_size, out_size,
                       kernel_size=4, stride=2, padding=1,
                       padding_mode="reflect",
                       bias=False if batch_norm else True)
             if encode else
             nn.ConvTranspose2d(in_size, out_size,
                                kernel_size=4, stride=2, padding=1,
                                bias=False if batch_norm else True)]

    if batch_norm:
        block.append(nn.BatchNorm2d(out_size))
    if activation == "leaky":
        block.append(nn.LeakyReLU(0.2))
    elif activation == "sigmoid":
        block.append(nn.Sigmoid())
    elif activation == "tanh":
        block.append(nn.Tanh())
    elif activation == "relu":
        block.append(nn.ReLU())
    if drop_out:
        block.append(nn.Dropout(0.5))

    return nn.Sequential(*block)
Convolutional blocks of the Generator and the Discriminator.

    Let Ck denote a Convolution-BtachNorm-ReLU block with k filters.
    CDk denotes a Convolution-BtachNorm-Dropout-ReLU block with 50% dropout.
    All convolutions are 4 x 4 spatial filters with stride 2. Convolutions in
    the encoder and discriminator downsample by a factor of 2, whereas in the
    decoder they upsample by a factor of 2.
    
Convolutional blocks of the Generator and the Discriminator.
Let Ck denote a Convolution-BtachNorm-ReLU block with k filters.
Convolutional blocks of the Generator and the Discriminator . Let Ck denote a Convolution - BtachNorm - ReLU block with k filters .
def make_conv(in_size, out_size, encode, batch_norm, activation, drop_out):
    block = [nn.Conv2d(in_size, out_size,
                       kernel_size=4, stride=2, padding=1,
                       padding_mode="reflect",
                       bias=False if batch_norm else True)
             if encode else
             nn.ConvTranspose2d(in_size, out_size,
                                kernel_size=4, stride=2, padding=1,
                                bias=False if batch_norm else True)]
    if batch_norm:
        block.append(nn.BatchNorm2d(out_size))
    if activation == "leaky":
        block.append(nn.LeakyReLU(0.2))
    elif activation == "sigmoid":
        block.append(nn.Sigmoid())
    elif activation == "tanh":
        block.append(nn.Tanh())
    elif activation == "relu":
        block.append(nn.ReLU())
    if drop_out:
        block.append(nn.Dropout(0.5))
    return nn.Sequential(*block)
def make_conv ( in_size , out_size , encode , batch_norm , activation , drop_out ) : block = [ nn . Conv2d ( in_size , out_size , kernel_size = 4 , stride = 2 , padding = 1 , padding_mode = "reflect" , bias = False if batch_norm else True ) if encode else nn . ConvTranspose2d ( in_size , out_size , kernel_size = 4 , stride = 2 , padding = 1 , bias = False if batch_norm else True ) ] if batch_norm : block . append ( nn . BatchNorm2d ( out_size ) ) if activation == "leaky" : block . append ( nn . LeakyReLU ( 0.2 ) ) elif activation == "sigmoid" : block . append ( nn . Sigmoid ( ) ) elif activation == "tanh" : block . append ( nn . Tanh ( ) ) elif activation == "relu" : block . append ( nn . ReLU ( ) ) if drop_out : block . append ( nn . Dropout ( 0.5 ) ) return nn . Sequential ( * block )
Convolutional blocks of the Generator and the Discriminator.
Convolutional blocks of the Generator and the Discriminator .
"""Convolutional blocks of the Generator and the Discriminator.

    Let Ck denote a Convolution-BtachNorm-ReLU block with k filters.
    CDk denotes a Convolution-BtachNorm-Dropout-ReLU block with 50% dropout.
    All convolutions are 4 x 4 spatial filters with stride 2. Convolutions in
    the encoder and discriminator downsample by a factor of 2, whereas in the
    decoder they upsample by a factor of 2.
    """
in_size
out_size
encode
batch_norm
activation
drop_out