code: def get_loader(
      root, json, vocab, transform, batch_size, shuffle, num_workers
  ):
      """Returns torch.utils.data.DataLoader for custom coco dataset."""
      # COCO caption dataset
      coco = CocoDataset(
          root=root, json=json, vocab=vocab, transform=transform
      )
  
      # Data loader for COCO dataset
      # This will return (images, captions, lengths) for each iteration.
      # images: a tensor of shape (batch_size, 3, 224, 224).
      # captions: a tensor of shape (batch_size, padded_length).
      # lengths: a list indicating valid length for each caption. length is (batch_size).
      data_loader = torch.utils.data.DataLoader(
          dataset=coco,
          batch_size=batch_size,
          shuffle=shuffle,
          num_workers=num_workers,
          collate_fn=collate_fn,
      )
      return data_loader
  
file_path: pytorch-tutorial/tutorials/03-advanced/image_captioning/data_loader.py
imports: import torch
  import torchvision.transforms
  import torch.utils.data
  import os
  import pickle
  import numpy
  import nltk
  from PIL import Image
  from build_vocab import Vocabulary
  from pycocotools.coco import COCO
label_desc: Use image node_id 2 for calling a global function with example usage: get_loader(root, json, vocab, transform, batch_size, shuffle, num_workers) and returns: data_loader