code: def __init__(
      self,
      block,
      nblocks=None,
      avgpool=None,
      nfilters=None,
      nclasses=None,
      nmasks=None,
      input_size=32,
      level=None,
      filter_size=None,
      first_filter_size=None,
      use_act=False,
      train_masks=False,
      mix_maps=None,
      act=None,
      scale_noise=1,
      unique_masks=False,
      debug=False,
      noise_type=None,
      pool_type=None,
  ):
      super(PerturbResNet, self).__init__()
      self.nfilters = nfilters
      self.unique_masks = unique_masks
      self.noise_type = noise_type
      self.train_masks = train_masks
      self.pool_type = pool_type
      self.mix_maps = mix_maps
      self.act = act_fn(act)  # (7) Felix added this
  
      # layers = [PerturbLayer(in_channels=3, out_channels=nfilters, nmasks=nmasks, level=level*scale_noise,
      # debug=debug, filter_size=first_filter_size, use_act=use_act, train_masks=train_masks, input_size=input_size,
      # act=act, unique_masks=self.unique_masks, noise_type=self.noise_type, mix_maps=mix_maps)]
  
      layers = [
          PerturbLayerFirst(
              in_channels=3,
              out_channels=3 * nfilters,
              nmasks=nfilters * 5,
              level=level * scale_noise * 20,
              debug=debug,
              filter_size=first_filter_size,
              use_act=use_act,
              train_masks=train_masks,
              input_size=input_size,
              act=act,
              unique_masks=self.unique_masks,
              noise_type=self.noise_type,
              mix_maps=mix_maps,
          )
      ]  # scale noise 20x at 1st layer
      # 256x3  X (5) = 3840
      # 128x3  X (5) = 1920
  
      # (3) Felix modified this
  
      if first_filter_size == 7:
          layers.append(
              nn.MaxPool2d(kernel_size=3, stride=2, padding=1)
          )
  
      # self.pre_layers = nn.Sequential(*layers)
      self.pre_layers = nn.Sequential(
          *layers,  # (4) Felix modified this, not really necessary.
          nn.Conv2d(
              self.nfilters * 3 * 1,
              self.nfilters,
              kernel_size=1,
              stride=1,
              bias=False,
          ),
          # mapping 10*nfilters back to nfilters with 1x1 conv
          nn.BatchNorm2d(self.nfilters),
          self.act,
      )
  
      self.layer1 = self._make_layer(
          block,
          1 * nfilters,
          nblocks[0],
          stride=1,
          level=level,
          nmasks=nmasks,
          use_act=True,
          filter_size=filter_size,
          act=act,
          input_size=input_size,
      )
      self.layer2 = self._make_layer(
          block,
          2 * nfilters,
          nblocks[1],
          stride=2,
          level=level,
          nmasks=nmasks,
          use_act=True,
          filter_size=filter_size,
          act=act,
          input_size=input_size,
      )
      self.layer3 = self._make_layer(
          block,
          4 * nfilters,
          nblocks[2],
          stride=2,
          level=level,
          nmasks=nmasks,
          use_act=True,
          filter_size=filter_size,
          act=act,
          input_size=input_size // 2,
      )
      self.layer4 = self._make_layer(
          block,
          8 * nfilters,
          nblocks[3],
          stride=2,
          level=level,
          nmasks=nmasks,
          use_act=True,
          filter_size=filter_size,
          act=act,
          input_size=input_size // 4,
      )
      self.avgpool = nn.AvgPool2d(avgpool, stride=1)
      self.linear = nn.Linear(8 * nfilters * block.expansion, nclasses)
  
imports: import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 1 to create a new PerturbResNet object from inherited base classes: nn with example: obj = PerturbResNet(block, nblocks, avgpool, nfilters, nclasses, nmasks, input_size, level, filter_size, first_filter_size, use_act, train_masks, mix_maps, act, scale_noise, unique_masks, debug, noise_type, pool_type)