code: def predictions_gt_images_handler(engine, logger, *args, **kwargs):
      x, _ = engine.state.batch
      y_pred, y = engine.state.output
  
      num_x = num_y = 4
      le = num_x * num_y
      fig = plt.figure(figsize=(20, 20))
      trans = transforms.ToPILImage()
      classes = (
          "plane",
          "car",
          "bird",
          "cat",
          "deer",
          "dog",
          "frog",
          "horse",
          "ship",
          "truck",
      )
      enumeration = {k: v for v, k in enumerate(classes, 1)}
      Task.current_task().connect_label_enumeration(enumeration)
  
      for idx in range(le):
          preds = torch.argmax(F.softmax(y_pred[idx], dim=0))
          probs = torch.max(F.softmax(y_pred[idx], dim=0))
          ax = fig.add_subplot(
              num_x, num_y, idx + 1, xticks=[], yticks=[]
          )
          ax.imshow(trans(x[idx]))
          ax.set_title(
              "{0} {1:.1f}% (label: {2})".format(
                  classes[preds], probs * 100, classes[y[idx]]
              ),
              color=("green" if preds == y[idx] else "red"),
          )
      logger.writer.add_figure(
          "predictions vs actuals",
          figure=fig,
          global_step=engine.state.epoch,
      )
  
imports: from pathlib import Path
  import matplotlib.pyplot
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.optim
  import torchvision.datasets
  import torchvision.transforms
  from ignite.contrib.handlers import TensorboardLogger
  from ignite.engine import Events, create_supervised_trainer, create_supervised_evaluator
  from ignite.handlers import global_step_from_engine
  from ignite.metrics import Accuracy, Loss, Recall
  from ignite.utils import setup_logger
  from torch.utils.tensorboard import SummaryWriter
  from tqdm import tqdm
  from clearml import Task, StorageManager, OutputModel
label_desc: Use image node_id 2 for calling a global function with example usage: predictions_gt_images_handler(engine, logger) without return types