code: def __init__(
      self,
      block,
      inplanes,
      planes,
      num_blocks,
      stride=1,
      dilation=1,
      avg_down=False,
      conv_cfg=None,
      norm_cfg=dict(type="BN"),
      multi_grid=None,
      contract_dilation=False,
      **kwargs,
  ):
      self.block = block
  
      downsample = None
      if stride != 1 or inplanes != planes * block.expansion:
          downsample = []
          conv_stride = stride
          if avg_down:
              conv_stride = 1
              downsample.append(
                  nn.AvgPool2d(
                      kernel_size=stride,
                      stride=stride,
                      ceil_mode=True,
                      count_include_pad=False,
                  )
              )
          downsample.extend(
              [
                  build_conv_layer(
                      conv_cfg,
                      inplanes,
                      planes * block.expansion,
                      kernel_size=1,
                      stride=conv_stride,
                      bias=False,
                  ),
                  build_norm_layer(norm_cfg, planes * block.expansion)[
                      1
                  ],
              ]
          )
          downsample = nn.Sequential(*downsample)
  
      layers = []
      if multi_grid is None:
          if dilation > 1 and contract_dilation:
              first_dilation = dilation // 2
          else:
              first_dilation = dilation
      else:
          first_dilation = multi_grid[0]
      layers.append(
          block(
              inplanes=inplanes,
              planes=planes,
              stride=stride,
              dilation=first_dilation,
              downsample=downsample,
              conv_cfg=conv_cfg,
              norm_cfg=norm_cfg,
              **kwargs,
          )
      )
      inplanes = planes * block.expansion
      for i in range(1, num_blocks):
          layers.append(
              block(
                  inplanes=inplanes,
                  planes=planes,
                  stride=1,
                  dilation=dilation
                  if multi_grid is None
                  else multi_grid[i],
                  conv_cfg=conv_cfg,
                  norm_cfg=norm_cfg,
                  **kwargs,
              )
          )
      super(ResLayer, self).__init__(*layers)
  
imports: from annotator.uniformer.mmcv.cnn import build_conv_layer, build_norm_layer
  from torch import nn
label_desc: Use image node_id 1 to create a new ResLayer object from inherited base classes: nn with example: obj = ResLayer(block, inplanes, planes, num_blocks, stride, dilation, avg_down, conv_cfg, norm_cfg, multi_grid, contract_dilation)