code: def __init__(
      self,
      input_nc,
      output_nc,
      ngf=32,
      n_downsample_global=3,
      n_blocks_global=9,
      n_local_enhancers=1,
      n_blocks_local=3,
      norm_layer=nn.BatchNorm2d,
      padding_type="reflect",
  ):
      super(LocalEnhancer, self).__init__()
      self.n_local_enhancers = n_local_enhancers
  
      ###### global generator model #####
      ngf_global = ngf * (2**n_local_enhancers)
      model_global = GlobalGenerator(
          input_nc,
          output_nc,
          ngf_global,
          n_downsample_global,
          n_blocks_global,
          norm_layer,
      ).model
      model_global = [
          model_global[i] for i in range(len(model_global) - 3)
      ]  # get rid of final convolution layers
      self.model = nn.Sequential(*model_global)
  
      ###### local enhancer layers #####
      for n in range(1, n_local_enhancers + 1):
          ### downsample
          ngf_global = ngf * (2 ** (n_local_enhancers - n))
          model_downsample = [
              nn.ReflectionPad2d(3),
              nn.Conv2d(input_nc, ngf_global, kernel_size=7, padding=0),
              norm_layer(ngf_global),
              nn.ReLU(True),
              nn.Conv2d(
                  ngf_global,
                  ngf_global * 2,
                  kernel_size=3,
                  stride=2,
                  padding=1,
              ),
              norm_layer(ngf_global * 2),
              nn.ReLU(True),
          ]
          ### residual blocks
          model_upsample = []
          for i in range(n_blocks_local):
              model_upsample += [
                  ResnetBlock(
                      ngf_global * 2,
                      padding_type=padding_type,
                      norm_layer=norm_layer,
                  )
              ]
  
          ### upsample
          model_upsample += [
              nn.ConvTranspose2d(
                  ngf_global * 2,
                  ngf_global,
                  kernel_size=3,
                  stride=2,
                  padding=1,
                  output_padding=1,
              ),
              norm_layer(ngf_global),
              nn.ReLU(True),
          ]
  
          ### final convolution
          if n == n_local_enhancers:
              model_upsample += [
                  nn.ReflectionPad2d(3),
                  nn.Conv2d(ngf, output_nc, kernel_size=7, padding=0),
                  nn.Tanh(),
              ]
  
          setattr(
              self,
              "model" + str(n) + "_1",
              nn.Sequential(*model_downsample),
          )
          setattr(
              self,
              "model" + str(n) + "_2",
              nn.Sequential(*model_upsample),
          )
  
      self.downsample = nn.AvgPool2d(
          3, stride=2, padding=[1, 1], count_include_pad=False
      )
  
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 LocalEnhancer object from inherited base classes: nn with example: obj = LocalEnhancer(input_nc, output_nc, ngf, n_downsample_global, n_blocks_global, n_local_enhancers, n_blocks_local, norm_layer, padding_type)