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, optional): Layers of ResNet, Default: 50.
      width (int, optional): Base width per convolution group for each convolution block, Default: 64.
      num_classes (int, optional): Output dim of last fc layer. If num_classes <= 0, last fc layer 
                          will not be defined. Default: 1000.
      with_pool (bool, optional): Use pool before the last fc layer or not. Default: True.
      groups (int, optional): Number of groups for each convolution block, Default: 1.
  Returns:
      :ref:`api_paddle_nn_Layer`. An instance of ResNet model.
  Examples:
      .. code-block:: python
          import paddle
          from paddle.vision.models import ResNet
          from paddle.vision.models.resnet import BottleneckBlock, BasicBlock
          # build ResNet with 18 layers
          resnet18 = ResNet(BasicBlock, 18)
          # build ResNet with 50 layers
          resnet50 = ResNet(BottleneckBlock, 50)
          # build Wide ResNet model
          wide_resnet50_2 = ResNet(BottleneckBlock, 50, width=64*2)
          # build ResNeXt model
          resnext50_32x4d = ResNet(BottleneckBlock, 50, width=4, groups=32)
          x = paddle.rand([1, 3, 224, 224])
          out = resnet18(x)
          print(out.shape)
          # [1, 1000]
class_docstr_tok: ["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",",","optional",")",":","Layers","of","ResNet",",","Default",":","50.","width","(","int",",","optional",")",":","Base","width","per","convolution","group","for","each","convolution","block",",","Default",":","64.","num_classes","(","int",",","optional",")",":","Output","dim","of","last","fc","layer",".","If","num_classes","<","=","0",",","last","fc","layer","will","not","be","defined",".","Default",":","1000.","with_pool","(","bool",",","optional",")",":","Use","pool","before","the","last","fc","layer","or","not",".","Default",":","True",".","groups","(","int",",","optional",")",":","Number","of","groups","for","each","convolution","block",",","Default",":","1",".","Returns",":",":","ref",":","`","api_paddle_nn_Layer","`",".","An","instance","of","ResNet","model",".","Examples",":","..","code-block",":",":","python","import","paddle","from","paddle.vision.models","import","ResNet","from","paddle.vision.models.resnet","import","BottleneckBlock",",","BasicBlock","#","build","ResNet","with","18","layers","resnet18","=","ResNet","(","BasicBlock",",","18",")","#","build","ResNet","with","50","layers","resnet50","=","ResNet","(","BottleneckBlock",",","50",")","#","build","Wide","ResNet","model","wide_resnet50_2","=","ResNet","(","BottleneckBlock",",","50",",","width=64","*","2",")","#","build","ResNeXt","model","resnext50_32x4d","=","ResNet","(","BottleneckBlock",",","50",",","width=4",",","groups=32",")","x","=","paddle.rand","(","[","1",",","3",",","224",",","224","]",")","out","=","resnet18","(","x",")","print","(","out.shape",")","#","[","1",",","1000","]"]
code: def forward(self, x):
      x = self.conv1(x)
      x = self.bn1(x)
      x = self.relu(x)
      x = self.maxpool(x)
  
      out_layers = []
      x = self.layer1(x)
      out_layers.append(x)
      x = self.layer2(x)
      out_layers.append(x)
      x = self.layer3(x)
      out_layers.append(x)
      x = self.layer4(x)
      out_layers.append(x)
  
      if self.with_pool:
          x = self.avgpool(x)
  
      return out_layers
  
imports: from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  from paddle.utils.download import get_weights_path_from_url
  from ppdet.core.workspace import register, serializable
  from ..shape_spec import ShapeSpec
label_desc: Use image node_id 4 for calling the ResNet obj's underlying member method code with example usage: obj.forward(x) and returns: out_layers