class_docstr: Res2Layer to build Res2Net style backbone.
  
  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 bottle2neck. 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')
      scales (int): Scales used in Res2Net. Default: 4
      base_width (int): Basic width of each scale. Default: 26
code: def __init__(
      self,
      block,
      inplanes,
      planes,
      num_blocks,
      stride=1,
      avg_down=True,
      conv_cfg=None,
      norm_cfg=dict(type="BN"),
      scales=4,
      base_width=26,
      **kwargs,
  ):
      self.block = block
  
      downsample = None
      if stride != 1 or inplanes != planes * block.expansion:
          downsample = nn.Sequential(
              nn.AvgPool2d(
                  kernel_size=stride,
                  stride=stride,
                  ceil_mode=True,
                  count_include_pad=False,
              ),
              build_conv_layer(
                  conv_cfg,
                  inplanes,
                  planes * block.expansion,
                  kernel_size=1,
                  stride=1,
                  bias=False,
              ),
              build_norm_layer(norm_cfg, planes * block.expansion)[1],
          )
  
      layers = []
      layers.append(
          block(
              inplanes=inplanes,
              planes=planes,
              stride=stride,
              downsample=downsample,
              conv_cfg=conv_cfg,
              norm_cfg=norm_cfg,
              scales=scales,
              base_width=base_width,
              stage_type="stage",
              **kwargs,
          )
      )
      inplanes = planes * block.expansion
      for i in range(1, num_blocks):
          layers.append(
              block(
                  inplanes=inplanes,
                  planes=planes,
                  stride=1,
                  conv_cfg=conv_cfg,
                  norm_cfg=norm_cfg,
                  scales=scales,
                  base_width=base_width,
                  **kwargs,
              )
          )
      super(Res2Layer, self).__init__(*layers)
  
imports: import math
  import torch
  import torch.nn
  import torch.utils.checkpoint
  from mmcv.cnn import build_conv_layer, build_norm_layer, constant_init, kaiming_init
  from mmcv.runner import load_checkpoint
  from torch.nn.modules.batchnorm import _BatchNorm
  from mmdet.utils import get_root_logger
  from ..builder import BACKBONES
  from .resnet import Bottleneck
  from .resnet import ResNet
label_desc: Use image node_id 1 to create a new Res2Layer object from inherited base classes: nn with example: obj = Res2Layer(block, inplanes, planes, num_blocks, stride, avg_down, conv_cfg, norm_cfg, scales, base_width)