code: def get_data_loader(
      dataset_name,
      data_dir,
      batch_size=1,
      dataset_transforms=None,
      is_training_set=True,
      shuffle=True,
  ):
      if not dataset_transforms:
          dataset_transforms = []
      trans = transforms.Compose(
          [transforms.ToTensor()] + dataset_transforms
      )
      if dataset_name == "MNIST":
          dataset = MNIST
      else:
          dataset = getattr(datasets, dataset_name)
      print("downloading data")
      dset = dataset(
          root=data_dir,
          train=is_training_set,
          transform=trans,
          download=True,
      )
      print("download complete.")
      return DataLoader(dset, batch_size=batch_size, shuffle=shuffle)
  
file_path: pyro/pyro/contrib/examples/util.py
imports: import os
  import sys
  import torchvision.datasets
  from torch.utils.data import DataLoader
  from torchvision import transforms
label_desc: Use image node_id 1 for calling a global function with example usage: get_data_loader(dataset_name, data_dir, batch_size, dataset_transforms, is_training_set, shuffle) and returns: DataLoader