class_docstr: Residual Network, see https://arxiv.org/abs/1512.03385
  Args:
      depth (int): ResNet depth, should be 34, 50.
      freeze_at (int): freeze the backbone at which stage
      norm_type (str): normalization type, 'bn'/'sync_bn'/'affine_channel'
      freeze_norm (bool): freeze normalization layers
      norm_decay (float): weight decay for normalization layer weights
      variant (str): ResNet variant, supports 'a', 'b', 'c', 'd' currently
      feature_maps (list): index of stages whose feature maps are returned
      dcn_v2_stages (list): index of stages who select deformable conv v2
      nonlocal_stages (list): index of stages who select nonlocal networks
class_docstr_tok: ["Residual","Network",",","see","https",":","\/\/arxiv.org\/abs\/1512.03385","Args",":","depth","(","int",")",":","ResNet","depth",",","should","be","34",",","50.","freeze_at","(","int",")",":","freeze","the","backbone","at","which","stage","norm_type","(","str",")",":","normalization","type",",","'bn'\/'sync_bn'\/'affine_channel'","freeze_norm","(","bool",")",":","freeze","normalization","layers","norm_decay","(","float",")",":","weight","decay","for","normalization","layer","weights","variant","(","str",")",":","ResNet","variant",",","supports","'","a","'",",","'","b","'",",","'","c","'",",","'d","'","currently","feature_maps","(","list",")",":","index","of","stages","whose","feature","maps","are","returned","dcn_v2_stages","(","list",")",":","index","of","stages","who","select","deformable","conv","v2","nonlocal_stages","(","list",")",":","index","of","stages","who","select","nonlocal","networks"]
code: def __init__(
      self,
      depth=34,
      freeze_at=0,
      norm_type="sync_bn",
      freeze_norm=False,
      norm_decay=0.0,
      variant="b",
      feature_maps=[3, 4, 5],
      dcn_v2_stages=[],
      weight_prefix_name="",
      nonlocal_stages=[],
      get_prediction=False,
      class_dim=1000,
  ):
      super(ResNet, self).__init__()
  
      if isinstance(feature_maps, Integral):
          feature_maps = [feature_maps]
  
      assert depth in [34, 50], "depth {} not in [34, 50]"
      assert variant in ["a", "b", "c", "d"], "invalid ResNet variant"
      assert 0 <= freeze_at <= 4, "freeze_at should be 0, 1, 2, 3 or 4"
      assert len(feature_maps) > 0, "need one or more feature maps"
      assert norm_type in ["bn", "sync_bn", "affine_channel"]
      assert not (
          len(nonlocal_stages) > 0 and depth < 50
      ), "non-local is not supported for resnet18 or resnet34"
  
      self.depth = depth
      self.freeze_at = freeze_at
      self.norm_type = norm_type
      self.norm_decay = norm_decay
      self.freeze_norm = freeze_norm
      self.variant = variant
      self._model_type = "ResNet"
      self.feature_maps = feature_maps
      self.dcn_v2_stages = dcn_v2_stages
      self.depth_cfg = {
          34: ([3, 4, 6, 3], self.basicblock),
          50: ([3, 4, 6, 3], self.bottleneck),
      }
      self.stage_filters = [64, 128, 256, 512]
      self._c1_out_chan_num = 64
      self.na = NameAdapter(self)
      self.prefix_name = weight_prefix_name
  
      self.nonlocal_stages = nonlocal_stages
      self.nonlocal_mod_cfg = {
          50: 2,
          101: 5,
          152: 8,
          200: 12,
      }
      self.get_prediction = get_prediction
      self.class_dim = class_dim
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  from collections import OrderedDict
  from numbers import Integral
  from paddle import fluid
  from paddle.fluid.param_attr import ParamAttr
  from paddle.fluid.framework import Variable
  from paddle.fluid.regularizer import L2Decay
  from paddle.fluid.initializer import Constant
  from .nonlocal_helper import add_space_nonlocal
  from .name_adapter import NameAdapter
label_desc: Use image node_id 1 to create a new ResNet object from inherited base classes: object with example: obj = ResNet(depth, freeze_at, norm_type, freeze_norm, norm_decay, variant, feature_maps, dcn_v2_stages, weight_prefix_name, nonlocal_stages, get_prediction, class_dim)