code: def create_data_loader(root_dir, batch_size, nproc):
      dir_path = os.path.realpath(root_dir)
      data_transform = transforms.Compose(
          [
              transforms.Resize(256),
              transforms.ColorJitter(),
              transforms.RandomCrop(224),
              transforms.RandomHorizontalFlip(),
              transforms.Resize(128),
              transforms.ToTensor(),
          ]
      )
  
      catdogs = ImageFolder(dir_path, data_transform)
      dataset_size = len(catdogs)
  
      if (
          "SANITY_CHECK" in os.environ
          and os.environ["SANITY_CHECK"] == "1"
      ):
          # reduce dataset size to speedup the check
          train_size = 2 * nproc * batch_size
          val_size = 2 * nproc * batch_size
          test_size = dataset_size - train_size - val_size
          train_set, val_set, _ = torch.utils.data.random_split(
              catdogs, [train_size, val_size, test_size]
          )
      else:
          train_split = 0.8
          train_size = int(dataset_size * train_split)
          val_size = dataset_size - train_size
          train_set, val_set = torch.utils.data.random_split(
              catdogs, [train_size, val_size]
          )
  
      train_loader = DataLoader(
          train_set, batch_size=batch_size, shuffle=True, num_workers=0
      )
      val_loader = DataLoader(
          val_set, batch_size=batch_size, shuffle=False, num_workers=0
      )
      size = (train_size, val_size)
      return train_loader, val_loader, size
  
file_path: BigDL/python/nano/benchmark/resnet50/pytorch-cat-dog.py
imports: import os
  import json
  import torch
  import time
  from bigdl.nano.pytorch.vision.datasets import ImageFolder
  from bigdl.nano.pytorch.vision.transforms import transforms
  import argparse
  from torch.utils.data import DataLoader
  from torchvision.datasets.utils import download_and_extract_archive
  from bigdl.nano.pytorch.vision.models import resnet50
  from bigdl.nano.pytorch.vision.models import ImageClassifier
  from bigdl.nano.pytorch import Trainer
label_desc: Use image node_id 1 for calling a global function with example usage: create_data_loader(root_dir, batch_size, nproc) and returns: train_loader,  val_loader,  size