code: def _get_dataloader(
      net,
      train_dataset,
      val_dataset,
      train_transform,
      val_transform,
      batch_size,
      num_shards_per_process,
      args,
  ):
      """Get dataloader."""
      train_bfn = batchify.MaskRCNNTrainBatchify(
          net, num_shards_per_process
      )
      train_sampler = SplitSortedBucketSampler(
          train_dataset.get_im_aspect_ratio(),
          batch_size,
          num_parts=hvd.size() if args.horovod else 1,
          part_index=hvd.rank() if args.horovod else 0,
          shuffle=True,
      )
      train_loader = gluon.data.DataLoader(
          train_dataset.transform(
              train_transform(
                  net.short,
                  net.max_size,
                  net,
                  ashape=net.ashape,
                  multi_stage=args.mask_rcnn.use_fpn,
              )
          ),
          batch_sampler=train_sampler,
          batchify_fn=train_bfn,
          num_workers=args.num_workers,
      )
      val_bfn = batchify.Tuple(*[batchify.Append() for _ in range(2)])
      short = (
          net.short[-1]
          if isinstance(net.short, (tuple, list))
          else net.short
      )
      # validation use 1 sample per device
      val_loader = gluon.data.DataLoader(
          val_dataset.transform(val_transform(short, net.max_size)),
          num_shards_per_process,
          False,
          batchify_fn=val_bfn,
          last_batch="keep",
          num_workers=args.num_workers,
      )
      return train_loader, val_loader
  
file_path: gluon-cv/gluoncv/auto/estimators/mask_rcnn/utils.py
imports: import os
  import logging
  import mxnet
  from mxnet import gluon
  from ....None import data
  from ....data import batchify
  from ....data.sampler import SplitSortedBucketSampler
  from ....utils.metrics.coco_instance import COCOInstanceMetric
label_desc: Use image node_id 2 for calling a global function with example usage: _get_dataloader(net, train_dataset, val_dataset, train_transform, val_transform, batch_size, num_shards_per_process, args) and returns: train_loader,  val_loader