def __init__(self, in_channels, middle_channels, out_channels, conv_size=3, upscale=Upscale.transposed_conv):
    super().__init__()
    padding = 0
    if (conv_size == 3):
        padding = 1
    self.layer1 = nn.Sequential(nn.Conv2d(in_channels, middle_channels, conv_size, padding=padding), nn.BatchNorm2d(middle_channels), nn.ReLU(inplace=True))
    last_conv_channels = middle_channels
    if (upscale == Upscale.transposed_conv):
        self.layer2 = nn.Sequential(nn.ConvTranspose2d(middle_channels, middle_channels, 3, stride=2, padding=1, output_padding=1), nn.BatchNorm2d(middle_channels), nn.ReLU(inplace=True))
    elif (upscale == Upscale.upsample_bilinear):
        self.layer2 = nn.Upsample(scale_factor=2)
    else:
        self.layer2 = nn.PixelShuffle(upscale_factor=2)
        last_conv_channels = (middle_channels // 4)
    self.layer3 = nn.Sequential(nn.Conv2d(last_conv_channels, out_channels, conv_size, padding=padding), nn.BatchNorm2d(out_channels), nn.ReLU(inplace=True))
def __init__(self, in_channels, middle_channels, out_channels, conv_size=3, upscale=Upscale.transposed_conv):
    super().__init__()
    padding = 0
    if (conv_size == 3):
        padding = 1
    self.layer1 = nn.Sequential(nn.Conv2d(in_channels, middle_channels, conv_size, padding=padding), nn.BatchNorm2d(middle_channels), nn.ReLU(inplace=True))
    last_conv_channels = middle_channels
    if (upscale == Upscale.transposed_conv):
        self.layer2 = nn.Sequential(nn.ConvTranspose2d(middle_channels, middle_channels, 3, stride=2, padding=1, output_padding=1), nn.BatchNorm2d(middle_channels), nn.ReLU(inplace=True))
    elif (upscale == Upscale.upsample_bilinear):
        self.layer2 = nn.Upsample(scale_factor=2)
    else:
        self.layer2 = nn.PixelShuffle(upscale_factor=2)
        last_conv_channels = (middle_channels // 4)
    self.layer3 = nn.Sequential(nn.Conv2d(last_conv_channels, out_channels, conv_size, padding=padding), nn.BatchNorm2d(out_channels), nn.ReLU(inplace=True))