class_docstr: Res2Net, see https://arxiv.org/abs/1904.01169
  Args:
      depth (int): Res2Net depth, should be 50, 101, 152, 200.
      width (int): Res2Net width
      scales (int): Res2Net scale
      variant (str): Res2Net variant, supports 'a', 'b', 'c', 'd' currently
      lr_mult_list (list): learning rate ratio of different resnet stages(2,3,4,5),
                           lower learning rate ratio is need for pretrained model
                           got using distillation(default as [1.0, 1.0, 1.0, 1.0]).
      groups (int): The groups number of the Conv Layer.
      norm_type (str): normalization type, 'bn' or 'sync_bn'
      norm_decay (float): weight decay for normalization layer weights
      freeze_norm (bool): freeze normalization layers
      freeze_at (int): freeze the backbone at which stage
      return_idx (list): index of stages whose feature maps are returned,
                         index 0 stands for res2
      dcn_v2_stages (list): index of stages who select deformable conv v2
      num_stages (int): number of stages created
code: def __init__(
      self,
      depth=50,
      width=26,
      scales=4,
      variant="b",
      lr_mult_list=[1.0, 1.0, 1.0, 1.0],
      groups=1,
      norm_type="bn",
      norm_decay=0.0,
      freeze_norm=True,
      freeze_at=0,
      return_idx=[0, 1, 2, 3],
      dcn_v2_stages=[-1],
      num_stages=4,
  ):
      super(Res2Net, self).__init__()
  
      self._model_type = "Res2Net" if groups == 1 else "Res2NeXt"
  
      assert depth in [
          50,
          101,
          152,
          200,
      ], "depth {} not in [50, 101, 152, 200]"
      assert variant in ["a", "b", "c", "d"], "invalid Res2Net variant"
      assert num_stages >= 1 and num_stages <= 4
  
      self.depth = depth
      self.variant = variant
      self.norm_type = norm_type
      self.norm_decay = norm_decay
      self.freeze_norm = freeze_norm
      self.freeze_at = freeze_at
      if isinstance(return_idx, Integral):
          return_idx = [return_idx]
      assert max(return_idx) < num_stages, (
          "the maximum return index must smaller than num_stages, "
          "but received maximum return index is {} and num_stages "
          "is {}".format(max(return_idx), num_stages)
      )
      self.return_idx = return_idx
      self.num_stages = num_stages
      assert (
          len(lr_mult_list) == 4
      ), "lr_mult_list length must be 4 but got {}".format(
          len(lr_mult_list)
      )
      if isinstance(dcn_v2_stages, Integral):
          dcn_v2_stages = [dcn_v2_stages]
      assert max(dcn_v2_stages) < num_stages
      self.dcn_v2_stages = dcn_v2_stages
  
      block_nums = Res2Net_cfg[depth]
  
      # C1 stage
      if self.variant in ["c", "d"]:
          conv_def = [
              [3, 32, 3, 2, "conv1_1"],
              [32, 32, 3, 1, "conv1_2"],
              [32, 64, 3, 1, "conv1_3"],
          ]
      else:
          conv_def = [[3, 64, 7, 2, "conv1"]]
      self.res1 = nn.Sequential()
      for c_in, c_out, k, s, _name in conv_def:
          self.res1.add_sublayer(
              _name,
              ConvNormLayer(
                  ch_in=c_in,
                  ch_out=c_out,
                  filter_size=k,
                  stride=s,
                  groups=1,
                  act="relu",
                  norm_type=norm_type,
                  norm_decay=norm_decay,
                  freeze_norm=freeze_norm,
                  lr=1.0,
              ),
          )
  
      self._in_channels = [64, 256, 512, 1024]
      self._out_channels = [256, 512, 1024, 2048]
      self._out_strides = [4, 8, 16, 32]
  
      # C2-C5 stages
      self.res_layers = []
      for i in range(num_stages):
          lr_mult = lr_mult_list[i]
          stage_num = i + 2
          self.res_layers.append(
              self.add_sublayer(
                  "res{}".format(stage_num),
                  Blocks(
                      self._in_channels[i],
                      self._out_channels[i],
                      count=block_nums[i],
                      stage_num=stage_num,
                      width=width,
                      scales=scales,
                      groups=groups,
                      lr=lr_mult,
                      norm_type=norm_type,
                      norm_decay=norm_decay,
                      freeze_norm=freeze_norm,
                      dcn_v2=(i in self.dcn_v2_stages),
                  ),
              )
          )
  
imports: from numbers import Integral
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register, serializable
  from ..shape_spec import ShapeSpec
  from .resnet import ConvNormLayer
label_desc: Use image node_id 1 to create a new Res2Net object from inherited base classes: nn with example: obj = Res2Net(depth, width, scales, variant, lr_mult_list, groups, norm_type, norm_decay, freeze_norm, freeze_at, return_idx, dcn_v2_stages, num_stages)