class_docstr: ResNet model from
  `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_
  
  Args:
      Block (BasicBlock|BottleneckBlock): block module of model.
      depth (int): layers of resnet, default: 50.
      width (int): base width of resnet, default: 64.
      num_classes (int): output dim of last fc layer. If num_classes <=0, last fc layer
                          will not be defined. Default: 1000.
      with_pool (bool): use pool before the last fc layer or not. Default: True.
  
  Examples:
      .. code-block:: python
  
          import paddle
          from paddle.vision.models import ResNet
          from paddle.vision.models.resnet import BottleneckBlock, BasicBlock
  
          resnet50 = ResNet(BottleneckBlock, 50)
  
          wide_resnet50_2 = ResNet(BottleneckBlock, 50, width=64*2)
  
          resnet18 = ResNet(BasicBlock, 18)
  
          x = paddle.rand([1, 3, 224, 224])
          out = resnet18(x)
  
          print(out.shape)
code: def __init__(
      self, block, depth=50, width=64, num_classes=1000, with_pool=True
  ):
      super(ResNet, self).__init__()
      layer_cfg = {
          18: [2, 2, 2, 2],
          34: [3, 4, 6, 3],
          50: [3, 4, 6, 3],
          101: [3, 4, 23, 3],
          152: [3, 8, 36, 3],
      }
      layers = layer_cfg[depth]
      self.groups = 1
      self.base_width = width
      self.num_classes = num_classes
      self.with_pool = with_pool
      self._norm_layer = nn.BatchNorm2D
  
      self.inplanes = 64
      self.dilation = 1
  
      self.conv1 = nn.Conv2D(
          3,
          self.inplanes,
          kernel_size=7,
          stride=2,
          padding=3,
          bias_attr=False,
      )
      self.bn1 = self._norm_layer(self.inplanes)
      self.relu = nn.ReLU()
      self.maxpool = nn.MaxPool2D(kernel_size=3, stride=2, padding=1)
      self.layer1 = self._make_layer(block, 64, layers[0])
      self.layer2 = self._make_layer(block, 128, layers[1], stride=2)
      self.layer3 = self._make_layer(block, 256, layers[2], stride=2)
      self.layer4 = self._make_layer(block, 512, layers[3], stride=2)
      if with_pool:
          self.avgpool = nn.AdaptiveAvgPool2D((1, 1))
  
      if num_classes > 0:
          self.fc = nn.Linear(512 * block.expansion, num_classes)
  
imports: from __future__ import print_function
  import paddle
  import paddle.nn
  from paddle.utils.download import get_weights_path_from_url
label_desc: Use image node_id 1 to create a new ResNet object from inherited base classes: nn with example: obj = ResNet(block, depth, width, num_classes, with_pool)