code: def get_densenet(
      num_layers,
      pretrained=False,
      ctx=cpu(),
      root="~/.mxnet/models",
      **kwargs,
  ):
      r"""Densenet-BC model from the
      `"Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>`_ paper.
  
      Parameters
      ----------
      num_layers : int
          Number of layers for the variant of densenet. Options are 121, 161, 169, 201.
      pretrained : bool or str
          Boolean value controls whether to load the default pretrained weights for model.
          String value represents the hashtag for a certain version of pretrained weights.
      ctx : Context, default CPU
          The context in which to load the pretrained weights.
      root : str, default $MXNET_HOME/models
          Location for keeping the model parameters.
      norm_layer : object
          Normalization layer used (default: :class:`mxnet.gluon.nn.BatchNorm`)
          Can be :class:`mxnet.gluon.nn.BatchNorm` or :class:`mxnet.gluon.contrib.nn.SyncBatchNorm`.
      norm_kwargs : dict
          Additional `norm_layer` arguments, for example `num_devices=4`
          for :class:`mxnet.gluon.contrib.nn.SyncBatchNorm`.
      """
      num_init_features, growth_rate, block_config = densenet_spec[
          num_layers
      ]
      net = DenseNet(
          num_init_features, growth_rate, block_config, **kwargs
      )
      if pretrained:
          from .model_store import get_model_file
  
          net.load_parameters(
              get_model_file(
                  "densenet%d" % (num_layers), tag=pretrained, root=root
              ),
              ctx=ctx,
          )
          from ..data import ImageNet1kAttr
  
          attrib = ImageNet1kAttr()
          net.synset = attrib.synset
          net.classes = attrib.classes
          net.classes_long = attrib.classes_long
      return net
  
file_path: gluon-cv/gluoncv/model_zoo/densenet.py
imports: from mxnet.context import cpu
  from mxnet.gluon.block import HybridBlock
  from mxnet.gluon import nn
  from mxnet.gluon.nn import BatchNorm
  from mxnet.gluon.contrib.nn import HybridConcurrent, Identity
label_desc: Use image node_id 4 for calling a global function with example usage: get_densenet(num_layers, pretrained, ctx, root) and returns: net