code: def __init__(self, ngf=32, img_size=256, n_blocks=4, light=True):
      super(ResnetGenerator, self).__init__()
      self.light = light
      self.n_blocks = n_blocks
  
      DownBlock = []
      DownBlock += [
          nn.Pad2D([3, 3, 3, 3], "reflect"),
          nn.Conv2D(3, ngf, kernel_size=7, stride=1, bias_attr=False),
          nn.InstanceNorm2D(ngf, weight_attr=False, bias_attr=False),
          nn.ReLU(),
      ]
  
      DownBlock += [HourGlass(ngf, ngf), HourGlass(ngf, ngf)]
  
      # Down-Sampling
      n_downsampling = 2
      for i in range(n_downsampling):
          mult = 2**i
          DownBlock += [
              nn.Pad2D([1, 1, 1, 1], "reflect"),
              nn.Conv2D(
                  ngf * mult,
                  ngf * mult * 2,
                  kernel_size=3,
                  stride=2,
                  bias_attr=False,
              ),
              nn.InstanceNorm2D(
                  ngf * mult * 2, weight_attr=False, bias_attr=False
              ),
              nn.ReLU(),
          ]
  
      # Encoder Bottleneck
      mult = 2**n_downsampling
      for i in range(n_blocks):
          setattr(
              self, "EncodeBlock" + str(i + 1), ResnetBlock(ngf * mult)
          )
  
      # Class Activation Map
      self.gap_fc = nn.Linear(ngf * mult, 1, bias_attr=False)
      self.gmp_fc = nn.Linear(ngf * mult, 1, bias_attr=False)
      self.conv1x1 = nn.Conv2D(
          ngf * mult * 2, ngf * mult, kernel_size=1, stride=1
      )
      self.relu = nn.ReLU()
  
      # Gamma, Beta block
      FC = []
      if self.light:
          FC += [
              nn.Linear(ngf * mult, ngf * mult, bias_attr=False),
              nn.ReLU(),
              nn.Linear(ngf * mult, ngf * mult, bias_attr=False),
              nn.ReLU(),
          ]
  
      else:
          FC += [
              nn.Linear(
                  img_size // mult * img_size // mult * ngf * mult,
                  ngf * mult,
                  bias_attr=False,
              ),
              nn.ReLU(),
              nn.Linear(ngf * mult, ngf * mult, bias_attr=False),
              nn.ReLU(),
          ]
  
      # Decoder Bottleneck
      mult = 2**n_downsampling
      for i in range(n_blocks):
          setattr(
              self,
              "DecodeBlock" + str(i + 1),
              ResnetSoftAdaLINBlock(ngf * mult),
          )
  
      # Up-Sampling
      UpBlock = []
      for i in range(n_downsampling):
          mult = 2 ** (n_downsampling - i)
          UpBlock += [
              nn.Upsample(scale_factor=2),
              nn.Pad2D([1, 1, 1, 1], "reflect"),
              nn.Conv2D(
                  ngf * mult,
                  ngf * mult // 2,
                  kernel_size=3,
                  stride=1,
                  bias_attr=False,
              ),
              LIN(ngf * mult // 2),
              nn.ReLU(),
          ]
  
      UpBlock += [HourGlass(ngf, ngf), HourGlass(ngf, ngf, False)]
  
      UpBlock += [
          nn.Pad2D([3, 3, 3, 3], "reflect"),
          nn.Conv2D(3, 3, kernel_size=7, stride=1, bias_attr=False),
          nn.Tanh(),
      ]
  
      self.DownBlock = nn.Sequential(*DownBlock)
      self.FC = nn.Sequential(*FC)
      self.UpBlock = nn.Sequential(*UpBlock)
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 1 to create a new ResnetGenerator object from inherited base classes: nn with example: obj = ResnetGenerator(ngf, img_size, n_blocks, light)