code: def __init__(
      self,
      block,
      layers,
      dropout=0.0,
      num_features=512,
      input_size=112,
      zero_init_residual=False,
      stem_type="",
      dropblock=0.0,
      kaiming_init=False,
      groups=1,
      width_per_group=64,
      replace_stride_with_dilation=None,
      fp16=0,
  ):
      super(IResNet, self).__init__()
      self.input_size = input_size
      assert self.input_size % 16 == 0
      fc_scale = self.input_size // 16
      self.fc_scale = fc_scale * fc_scale
      self.fp16 = fp16
      self.inplanes = 64
      self.dilation = 1
      self.norm_layer = nn.BatchNorm2d
      self.act_layer = nn.PReLU
      self.eps = 1e-5
      if kaiming_init:
          self.eps = 2e-5
      self.stem_type = stem_type
      self.dropblock = dropblock
      if replace_stride_with_dilation is None:
          replace_stride_with_dilation = [False, False, False]
      if len(replace_stride_with_dilation) != 3:
          raise ValueError(
              "replace_stride_with_dilation should be None "
              "or a 3-element tuple, got {}".format(
                  replace_stride_with_dilation
              )
          )
      self.groups = groups
      self.base_width = width_per_group
      if stem_type != "D":
          self.conv1 = nn.Conv2d(
              3,
              self.inplanes,
              kernel_size=3,
              stride=1,
              padding=1,
              bias=False,
          )
      else:
          stem_width = self.inplanes // 2
          stem_chs = [stem_width, stem_width]
          self.conv1 = nn.Sequential(
              *[
                  nn.Conv2d(
                      3, stem_chs[0], 3, stride=1, padding=1, bias=False
                  ),
                  self.norm_layer(stem_chs[0], eps=self.eps),
                  self.act_layer(stem_chs[0]),
                  nn.Conv2d(
                      stem_chs[0],
                      stem_chs[1],
                      3,
                      stride=1,
                      padding=1,
                      bias=False,
                  ),
                  self.norm_layer(stem_chs[1], eps=self.eps),
                  self.act_layer(stem_chs[1]),
                  nn.Conv2d(
                      stem_chs[1],
                      self.inplanes,
                      3,
                      stride=1,
                      padding=1,
                      bias=False,
                  ),
              ]
          )
      logging.info(
          "iresnet, input_size: %d, fc_scale: %d, dropout: %.2f, stem_type: %s, fp16: %d"
          % (
              self.input_size,
              self.fc_scale,
              dropout,
              stem_type,
              self.fp16,
          )
      )
      logging.info(
          "iresnet, eps: %.6f, dropblock: %.3f, kaiming_init: %d"
          % (self.eps, self.dropblock, kaiming_init)
      )
      # self.conv1.requires_grad = False
      self.bn1 = nn.BatchNorm2d(self.inplanes, eps=self.eps)
      # self.bn1.requires_grad = False
      self.prelu = nn.PReLU(self.inplanes)
      # self.prelu.requires_grad = False
      self.layer1 = self._make_layer(block, 64, layers[0], stride=2)
      # self.layer1.requires_grad = False
      self.layer2 = self._make_layer(
          block,
          128,
          layers[1],
          stride=2,
          dilate=replace_stride_with_dilation[0],
      )
      # self.layer2.requires_grad = False
      self.layer3 = self._make_layer(
          block,
          256,
          layers[2],
          stride=2,
          dilate=replace_stride_with_dilation[1],
          dropblock=self.dropblock,
      )
      # self.layer3.requires_grad = False
      self.layer4 = self._make_layer(
          block,
          512,
          layers[3],
          stride=2,
          dilate=replace_stride_with_dilation[2],
          dropblock=self.dropblock,
      )
      # self.layer4.requires_grad = False
      self.bn2 = nn.BatchNorm2d(512 * block.expansion, eps=self.eps)
      # self.bn2.requires_grad = False
      if dropout > 0.0:
          self.dropout = nn.Dropout(p=dropout, inplace=True)
      else:
          self.dropout = None
      self.fc = nn.Linear(
          512 * block.expansion * self.fc_scale, num_features
      )
      # self.fc.requires_grad = False
      self.features = nn.BatchNorm1d(num_features, eps=self.eps)
      nn.init.constant_(self.features.weight, 1.0)
      self.features.weight.requires_grad = False
  
imports: import torch
  from torch import nn
  import torch.nn.functional
  import logging
label_desc: Use image node_id 1 to create a new IResNet object from inherited base classes: nn with example: obj = IResNet(block, layers, dropout, num_features, input_size, zero_init_residual, stem_type, dropblock, kaiming_init, groups, width_per_group, replace_stride_with_dilation, fp16)