code: def get_train_val_loaders(
      dataset,
      datapath=DATA_PATH,
      train_size=None,
      val_size=5000,
      train_batch_size=100,
      val_batch_size=1000,
      kwargs=None,
      train_transform=None,
      val_transform=None,
      train_shuffle=True,
      val_shuffle=False,
  ):
      """Support MNIST and CIFAR10"""
      if kwargs is None:
          kwargs = {}
      if train_transform is None:
          train_transform = transforms.ToTensor()
      if val_transform is None:
          val_transform = transforms.ToTensor()
  
      datapath = os.path.join(datapath, dataset)
  
      trainset = datasets.__dict__[dataset](
          datapath, train=True, download=True, transform=train_transform
      )
  
      if train_size is not None:
          assert train_size + val_size <= len(trainset)
  
      if val_size > 0:
          indices = list(range(len(trainset)))
          trainset = Subset(trainset, indices[val_size:])
  
          valset = datasets.__dict__[dataset](
              datapath,
              train=True,
              download=True,
              transform=val_transform,
          )
          valset = Subset(valset, indices[:val_size])
          val_loader = torch.utils.data.DataLoader(
              valset,
              batch_size=val_batch_size,
              shuffle=val_shuffle,
              **kwargs,
          )
  
      else:
          val_loader = None
  
      if train_size is not None:
          trainset = Subset(trainset, list(range(train_size)))
  
      train_loader = torch.utils.data.DataLoader(
          trainset,
          batch_size=train_batch_size,
          shuffle=train_shuffle,
          **kwargs,
      )
  
      return train_loader, val_loader
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import os
  import sys
  import pathlib
  from torch.utils.data.dataset import Subset
  import numpy
  import torch
  import torchvision.transforms
  import torchvision.datasets
  from advertorch.test_utils import LeNet5
label_desc: Use image node_id 9 for calling a global function with example usage: get_train_val_loaders(dataset, datapath, train_size, val_size, train_batch_size, val_batch_size, kwargs, train_transform, val_transform, train_shuffle, val_shuffle) and returns: train_loader,  val_loader