code: def get_resnet(
      version,
      num_layers,
      pretrained=False,
      device=cpu(),
      root=os.path.join(base.data_dir(), "models"),
      **kwargs,
  ):
      r"""ResNet V1 model from `"Deep Residual Learning for Image Recognition"
      <http://arxiv.org/abs/1512.03385>`_ paper.
      ResNet V2 model from `"Identity Mappings in Deep Residual Networks"
      <https://arxiv.org/abs/1603.05027>`_ paper.
  
      Parameters
      ----------
      version : int
          Version of ResNet. Options are 1, 2.
      num_layers : int
          Numbers of layers. Options are 18, 34, 50, 101, 152.
      pretrained : bool, default False
          Whether to load the pretrained weights for model.
      device : Device, default CPU
          The device in which to load the pretrained weights.
      root : str, default $MXNET_HOME/models
          Location for keeping the model parameters.
      """
      assert (
          num_layers in resnet_spec
      ), f"Invalid number of layers: {num_layers}. Options are {str(resnet_spec.keys())}"
      block_type, layers, channels = resnet_spec[num_layers]
      assert (
          version >= 1 and version <= 2
      ), f"Invalid resnet version: {version}. Options are 1 and 2."
      resnet_class = resnet_net_versions[version - 1]
      block_class = resnet_block_versions[version - 1][block_type]
      net = resnet_class(block_class, layers, channels, **kwargs)
      if pretrained:
          from ..model_store import get_model_file
  
          net.load_parameters(
              get_model_file(
                  f"resnet{num_layers}_v{version}", root=root
              ),
              device=device,
          )
      return net
  
imports: import os
  from ....device import cpu
  from ...block import HybridBlock
  from ...None import nn
  from ....None import base
  from ....util import use_np, wrap_ctx_to_device_func
  from ....None import npx
label_desc: Use image node_id 2 for calling a global function with example usage: get_resnet(version, num_layers, pretrained, device, root) and returns: net