code: def get_imagenet_iterator(
      root, batch_size, num_workers, data_shape=224, dtype="float32"
  ):
      """Dataset loader with preprocessing."""
      train_dir = os.path.join(root, "train")
      train_transform, val_transform = get_imagenet_transforms(
          data_shape, dtype
      )
      logging.info(
          "Loading image folder %s, this may take a bit long...",
          train_dir,
      )
      train_dataset = ImageFolderDataset(train_dir).transform_first(
          train_transform
      )
      train_data = DataLoader(
          train_dataset,
          batch_size,
          shuffle=True,
          last_batch="discard",
          num_workers=num_workers,
      )
      val_dir = os.path.join(root, "val")
      if not os.path.isdir(
          os.path.expanduser(os.path.join(root, "val", "n01440764"))
      ):
          user_warning = "Make sure validation images are stored in one subdir per category, a helper script is available at https://git.io/vNQv1"
          raise ValueError(user_warning)
      logging.info(
          "Loading image folder %s, this may take a bit long...",
          val_dir,
      )
      val_dataset = ImageFolderDataset(val_dir).transform(val_transform)
      val_data = DataLoader(
          val_dataset,
          batch_size,
          last_batch="keep",
          num_workers=num_workers,
      )
      return DataLoaderIter(train_data, dtype), DataLoaderIter(
          val_data, dtype
      )
  
imports: import os
  import random
  import tarfile
  import logging
  import tarfile
  import mxnet
  from mxnet.test_utils import get_cifar10
  from mxnet.gluon.data.vision import ImageFolderDataset
  from mxnet.gluon.data import DataLoader
  from mxnet.contrib.io import DataLoaderIter
label_desc: Use image node_id 3 for calling a global function with example usage: get_imagenet_iterator(root, batch_size, num_workers, data_shape, dtype) and returns: DataLoaderIter,  DataLoaderIter