code: def visualize_model(model, num_images=6):
      was_training = model.training
      model.eval()
      images_so_far = 0
      fig = plt.figure()
      train_loader, test_loader, class_names = load_dataset(data_dir)
  
      with torch.no_grad():
          for i, (inputs, labels) in enumerate(test_loader):
              outputs = model(inputs)
              _, preds = torch.max(outputs, 1)
  
              for j in range(inputs.size()[0]):
                  images_so_far += 1
                  ax = plt.subplot(num_images // 2, 2, images_so_far)
                  ax.axis("off")
                  ax.set_title(f"predicted: {class_names[preds[j]]}")
                  imshow(inputs.cpu().data[j])
  
                  if images_so_far == num_images:
                      model.train(mode=was_training)
                      return
          model.train(mode=was_training)
  
file_path: BigDL/python/orca/tutorial/pytorch/transfer_learning/train.py
imports: import os
  import numpy
  import matplotlib.pyplot
  import torch
  import torch.nn
  import torch.optim
  from torch.optim import lr_scheduler
  import torchvision
  from torchvision import datasets, transforms
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.learn.pytorch import Estimator
  from bigdl.orca.learn.metrics import Accuracy
label_desc: Use image node_id 8 for calling a global function with example usage: visualize_model(model, num_images) without return types