code: def resnet(units, num_stages, filter_list, num_classes, bottle_neck):
      bn_mom = config.bn_mom
      workspace = config.workspace
      kwargs = {
          "version_se": config.net_se,
          "version_input": config.net_input,
          "version_output": config.net_output,
          "version_unit": config.net_unit,
          "version_act": config.net_act,
          "bn_mom": bn_mom,
          "workspace": workspace,
          "memonger": config.memonger,
      }
      """Return ResNet symbol of
      Parameters
      ----------
      units : list
          Number of units in each stage
      num_stages : int
          Number of stage
      filter_list : list
          Channel size of each stage
      num_classes : int
          Ouput size of symbol
      dataset : str
          Dataset type, only cifar10 and imagenet supports
      workspace : int
          Workspace used in convolution operator
      """
      version_se = kwargs.get("version_se", 1)
      version_input = kwargs.get("version_input", 1)
      assert version_input >= 0
      version_output = kwargs.get("version_output", "E")
      fc_type = version_output
      version_unit = kwargs.get("version_unit", 3)
      act_type = kwargs.get("version_act", "prelu")
      memonger = kwargs.get("memonger", False)
      print(
          version_se,
          version_input,
          version_output,
          version_unit,
          act_type,
          memonger,
      )
      num_unit = len(units)
      assert num_unit == num_stages
      data = mx.sym.Variable(name="data")
  
      if config.fp16:
          data = mx.sym.Cast(data=data, dtype=np.float16)
  
      if version_input == 0:
          # data = mx.sym.BatchNorm(data=data, fix_gamma=True, eps=2e-5, momentum=bn_mom, name='bn_data')
          data = mx.sym.identity(data=data, name="id")
          data = data - 127.5
          data = data * 0.0078125
          body = Conv(
              data=data,
              num_filter=filter_list[0],
              kernel=(7, 7),
              stride=(2, 2),
              pad=(3, 3),
              no_bias=True,
              name="conv0",
              workspace=workspace,
          )
          body = mx.sym.BatchNorm(
              data=body,
              fix_gamma=False,
              eps=2e-5,
              momentum=bn_mom,
              name="bn0",
          )
          body = Act(data=body, act_type=act_type, name="relu0")
          # body = mx.sym.Pooling(data=body, kernel=(3, 3), stride=(2,2), pad=(1,1), pool_type='max')
      elif version_input == 2:
          data = mx.sym.BatchNorm(
              data=data,
              fix_gamma=True,
              eps=2e-5,
              momentum=bn_mom,
              name="bn_data",
          )
          body = Conv(
              data=data,
              num_filter=filter_list[0],
              kernel=(3, 3),
              stride=(1, 1),
              pad=(1, 1),
              no_bias=True,
              name="conv0",
              workspace=workspace,
          )
          body = mx.sym.BatchNorm(
              data=body,
              fix_gamma=False,
              eps=2e-5,
              momentum=bn_mom,
              name="bn0",
          )
          body = Act(data=body, act_type=act_type, name="relu0")
      else:
          data = mx.sym.identity(data=data, name="id")
          data = data - 127.5
          data = data * 0.0078125
          body = data
          body = Conv(
              data=body,
              num_filter=filter_list[0],
              kernel=(3, 3),
              stride=(1, 1),
              pad=(1, 1),
              no_bias=True,
              name="conv0",
              workspace=workspace,
          )
          body = mx.sym.BatchNorm(
              data=body,
              fix_gamma=False,
              eps=2e-5,
              momentum=bn_mom,
              name="bn0",
          )
          body = Act(data=body, act_type=act_type, name="relu0")
  
      for i in range(num_stages):
          # if version_input==0:
          #  body = residual_unit(body, filter_list[i+1], (1 if i==0 else 2, 1 if i==0 else 2), False,
          #                       name='stage%d_unit%d' % (i + 1, 1), bottle_neck=bottle_neck, **kwargs)
          # else:
          #  body = residual_unit(body, filter_list[i+1], (2, 2), False,
          #    name='stage%d_unit%d' % (i + 1, 1), bottle_neck=bottle_neck, **kwargs)
          body = residual_unit(
              body,
              filter_list[i + 1],
              (2, 2),
              False,
              name="stage%d_unit%d" % (i + 1, 1),
              bottle_neck=bottle_neck,
              **kwargs,
          )
          for j in range(units[i] - 1):
              body = residual_unit(
                  body,
                  filter_list[i + 1],
                  (1, 1),
                  True,
                  name="stage%d_unit%d" % (i + 1, j + 2),
                  bottle_neck=bottle_neck,
                  **kwargs,
              )
      if config.fp16:
          body = mx.sym.Cast(data=body, dtype=np.float32)
  
      if bottle_neck:
          body = Conv(
              data=body,
              num_filter=512,
              kernel=(1, 1),
              stride=(1, 1),
              pad=(0, 0),
              no_bias=True,
              name="convd",
              workspace=workspace,
          )
          body = mx.sym.BatchNorm(
              data=body,
              fix_gamma=False,
              eps=2e-5,
              momentum=bn_mom,
              name="bnd",
          )
          body = Act(data=body, act_type=act_type, name="relud")
  
      fc1 = symbol_utils.get_fc1(body, num_classes, fc_type)
      return fc1
  
file_path: insightface/recognition/partial_fc/mxnet/symbol/resnet.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  import os
  import mxnet
  import numpy
  from symbol import symbol_utils
  from default import config
label_desc: Use image node_id 9 for calling a global function with example usage: resnet(units, num_stages, filter_list, num_classes, bottle_neck) and returns: fc1