code: def load_data(data_dir):
      """Load the train/val data."""
  
      # Data augmentation and normalization for training
      # Just normalization for validation
      data_transforms = {
          "train": transforms.Compose(
              [
                  transforms.RandomResizedCrop(224),
                  transforms.RandomHorizontalFlip(),
                  transforms.ToTensor(),
                  transforms.Normalize(
                      [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]
                  ),
              ]
          ),
          "val": transforms.Compose(
              [
                  transforms.Resize(256),
                  transforms.CenterCrop(224),
                  transforms.ToTensor(),
                  transforms.Normalize(
                      [0.485, 0.456, 0.406], [0.229, 0.224, 0.225]
                  ),
              ]
          ),
      }
  
      image_datasets = {
          x: datasets.ImageFolder(
              os.path.join(data_dir, x), data_transforms[x]
          )
          for x in ["train", "val"]
      }
      dataloaders = {
          x: torch.utils.data.DataLoader(
              image_datasets[x],
              batch_size=4,
              shuffle=True,
              num_workers=4,
          )
          for x in ["train", "val"]
      }
      dataset_sizes = {
          x: len(image_datasets[x]) for x in ["train", "val"]
      }
      class_names = image_datasets["train"].classes
  
      return dataloaders, dataset_sizes, class_names
  
file_path: MachineLearningNotebooks/how-to-use-azureml/ml-frameworks/pytorch/train-hyperparameter-tune-deploy-with-pytorch/pytorch_train.py
imports: from __future__ import print_function, division
  import torch
  import torch.nn
  import torch.optim
  from torch.optim import lr_scheduler
  from torchvision import datasets, models, transforms
  import numpy
  import time
  import os
  import copy
  import argparse
  from azureml.core.run import Run
label_desc: Use image node_id 1 for calling a global function with example usage: load_data(data_dir) and returns: dataloaders,  dataset_sizes,  class_names