code: def net(self, input, class_dim=1000):
      layers = self.layers
      supported_layers = [18, 34, 50, 101, 152]
      assert (
          layers in supported_layers
      ), "supported layers are {} but input layer is {}".format(
          supported_layers, layers
      )
  
      if layers == 18:
          depth = [2, 2, 2, 2]
      elif layers == 34 or layers == 50:
          depth = [3, 4, 6, 3]
      elif layers == 101:
          depth = [3, 4, 23, 3]
      elif layers == 152:
          depth = [3, 8, 36, 3]
      num_filters = [64, 128, 256, 512]
  
      conv = self.conv_bn_layer(
          input=input,
          num_filters=64,
          filter_size=7,
          stride=2,
          act="relu",
          name="conv1",
      )
      conv = fluid.layers.pool2d(
          input=conv,
          pool_size=3,
          pool_stride=2,
          pool_padding=1,
          pool_type="max",
      )
      if layers >= 50:
          for block in range(len(depth)):
              for i in range(depth[block]):
                  if layers in [101, 152] and block == 2:
                      if i == 0:
                          conv_name = "res" + str(block + 2) + "a"
                      else:
                          conv_name = (
                              "res" + str(block + 2) + "b" + str(i)
                          )
                  else:
                      conv_name = "res" + str(block + 2) + chr(97 + i)
                  conv = self.bottleneck_block(
                      input=conv,
                      num_filters=num_filters[block],
                      stride=2 if i == 0 and block != 0 else 1,
                      name=conv_name,
                  )
  
          pool = fluid.layers.pool2d(
              input=conv,
              pool_size=7,
              pool_type="avg",
              global_pooling=True,
          )
          stdv = 1.0 / math.sqrt(pool.shape[1] * 1.0)
          out = fluid.layers.fc(
              input=pool,
              size=class_dim,
              param_attr=fluid.param_attr.ParamAttr(
                  initializer=fluid.initializer.Uniform(-stdv, stdv)
              ),
          )
      else:
          for block in range(len(depth)):
              for i in range(depth[block]):
                  conv_name = "res" + str(block + 2) + chr(97 + i)
                  conv = self.basic_block(
                      input=conv,
                      num_filters=num_filters[block],
                      stride=2 if i == 0 and block != 0 else 1,
                      is_first=block == i == 0,
                      name=conv_name,
                  )
  
          pool = fluid.layers.pool2d(
              input=conv,
              pool_size=7,
              pool_type="avg",
              global_pooling=True,
          )
          stdv = 1.0 / math.sqrt(pool.shape[1] * 1.0)
          out = fluid.layers.fc(
              input=pool,
              size=class_dim,
              param_attr=fluid.param_attr.ParamAttr(
                  initializer=fluid.initializer.Uniform(-stdv, stdv)
              ),
          )
      return out
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from builtins import chr
  from builtins import str
  from builtins import range
  from builtins import object
  import math
  import paddle
  import paddle.fluid
  from paddle.fluid.param_attr import ParamAttr
label_desc: Use image node_id 2 for calling the ResNet obj's underlying member method code with example usage: obj.net(input, class_dim) and returns: out