code: def __init__(
      self,
      input_nc,
      output_nc,
      ngf=32,
      n_downsampling=4,
      norm_layer=nn.BatchNorm2d,
  ):
      super(Encoder, self).__init__()
      self.output_nc = output_nc
  
      model = [
          nn.ReflectionPad2d(3),
          nn.Conv2d(input_nc, ngf, kernel_size=7, padding=0),
          norm_layer(ngf),
          nn.ReLU(True),
      ]
      ### downsample
      for i in range(n_downsampling):
          mult = 2**i
          model += [
              nn.Conv2d(
                  ngf * mult,
                  ngf * mult * 2,
                  kernel_size=3,
                  stride=2,
                  padding=1,
              ),
              norm_layer(ngf * mult * 2),
              nn.ReLU(True),
          ]
  
      ### upsample
      for i in range(n_downsampling):
          mult = 2 ** (n_downsampling - i)
          model += [
              nn.ConvTranspose2d(
                  ngf * mult,
                  int(ngf * mult / 2),
                  kernel_size=3,
                  stride=2,
                  padding=1,
                  output_padding=1,
              ),
              norm_layer(int(ngf * mult / 2)),
              nn.ReLU(True),
          ]
  
      model += [
          nn.ReflectionPad2d(3),
          nn.Conv2d(ngf, output_nc, kernel_size=7, padding=0),
          nn.Tanh(),
      ]
      self.model = nn.Sequential(*model)
  
imports: import torch
  import torch.nn
  import functools
  from torch.autograd import Variable
  import numpy
label_desc: Use image node_id 1 to create a new Encoder object from inherited base classes: nn with example: obj = Encoder(input_nc, output_nc, ngf, n_downsampling, norm_layer)