class_docstr: ResLayer to build ResNet style backbone for RPF in detectoRS.
  
  The difference between this module and base class is that we pass
  ``rfp_inplanes`` to the first block.
  
  Args:
      block (nn.Module): block used to build ResLayer.
      inplanes (int): inplanes of block.
      planes (int): planes of block.
      num_blocks (int): number of blocks.
      stride (int): stride of the first block. Default: 1
      avg_down (bool): Use AvgPool instead of stride conv when
          downsampling in the bottleneck. Default: False
      conv_cfg (dict): dictionary to construct and config conv layer.
          Default: None
      norm_cfg (dict): dictionary to construct and config norm layer.
          Default: dict(type='BN')
      downsample_first (bool): Downsample at the first block or last block.
          False for Hourglass, True for ResNet. Default: True
      rfp_inplanes (int, optional): The number of channels from RFP.
          Default: None. If specified, an additional conv layer will be
          added for ``rfp_feat``. Otherwise, the structure is the same as
          base class.
class_docstr_tok: ["ResLayer","to","build","ResNet","style","backbone","for","RPF","in","detectoRS",".","The","difference","between","this","module","and","base","class","is","that","we","pass","``","rfp_inplanes","``","to","the","first","block",".","Args",":","block","(","nn.Module",")",":","block","used","to","build","ResLayer",".","inplanes","(","int",")",":","inplanes","of","block",".","planes","(","int",")",":","planes","of","block",".","num_blocks","(","int",")",":","number","of","blocks",".","stride","(","int",")",":","stride","of","the","first","block",".","Default",":","1","avg_down","(","bool",")",":","Use","AvgPool","instead","of","stride","conv","when","downsampling","in","the","bottleneck",".","Default",":","False","conv_cfg","(","dict",")",":","dictionary","to","construct","and","config","conv","layer",".","Default",":","None","norm_cfg","(","dict",")",":","dictionary","to","construct","and","config","norm","layer",".","Default",":","dict","(","type='BN","'",")","downsample_first","(","bool",")",":","Downsample","at","the","first","block","or","last","block",".","False","for","Hourglass",",","True","for","ResNet",".","Default",":","True","rfp_inplanes","(","int",",","optional",")",":","The","number","of","channels","from","RFP",".","Default",":","None",".","If","specified",",","an","additional","conv","layer","will","be","added","for","``","rfp_feat","``",".","Otherwise",",","the","structure","is","the","same","as","base","class","."]
code: def __init__(
      self,
      block,
      inplanes,
      planes,
      num_blocks,
      stride=1,
      avg_down=False,
      conv_cfg=None,
      norm_cfg=dict(type="BN"),
      downsample_first=True,
      rfp_inplanes=None,
      **kwargs,
  ):
      self.block = block
      assert downsample_first, (
          f"downsampel_first={downsample_first} is "
          "not supported in DetectoRS"
      )
  
      downsample = None
      if stride != 1 or inplanes != planes * block.expansion:
          downsample = []
          conv_stride = stride
          if avg_down and stride != 1:
              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 = []
      layers.append(
          block(
              inplanes=inplanes,
              planes=planes,
              stride=stride,
              downsample=downsample,
              conv_cfg=conv_cfg,
              norm_cfg=norm_cfg,
              rfp_inplanes=rfp_inplanes,
              **kwargs,
          )
      )
      inplanes = planes * block.expansion
      for _ in range(1, num_blocks):
          layers.append(
              block(
                  inplanes=inplanes,
                  planes=planes,
                  stride=1,
                  conv_cfg=conv_cfg,
                  norm_cfg=norm_cfg,
                  **kwargs,
              )
          )
  
      super(ResLayer, self).__init__(*layers)
  
file_path: insightface/detection/scrfd/mmdet/models/backbones/detectors_resnet.py
imports: import torch.nn
  import torch.utils.checkpoint
  from mmcv.cnn import build_conv_layer, build_norm_layer, constant_init
  from ..builder import BACKBONES
  from .resnet import Bottleneck
  from .resnet import ResNet
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, avg_down, conv_cfg, norm_cfg, downsample_first, rfp_inplanes)