code: def make_training_sample_grid(
      left_images: Tensor,
      right_images: Tensor,
      disparities: Tensor,
      masks: Tensor,
      predictions: List[Tensor],
  ) -> np.ndarray:
      # detach images and renormalize to [0, 1]
      images_left = left_images.detach().cpu() * 0.5 + 0.5
      images_right = right_images.detach().cpu() * 0.5 + 0.5
      # detach the disparties and predictions
      disparities = disparities.detach().cpu()
      predictions = predictions[-1].detach().cpu()
      # keep only the first channel of pixels, and repeat it 3 times
      disparities = disparities[:, :1, ...].repeat(1, 3, 1, 1)
      predictions = predictions[:, :1, ...].repeat(1, 3, 1, 1)
      # unsqueeze and repeat the masks
      masks = masks.detach().cpu().unsqueeze(1).repeat(1, 3, 1, 1)
      # make a grid that will self normalize across the batch
      pred_grid = make_pair_grid(
          images_left,
          images_right,
          masks,
          disparities,
          predictions,
          orientation="horizontal",
      )
      pred_grid = pred_grid.permute(1, 2, 0).numpy()
      pred_grid = (pred_grid * 255).astype(np.uint8)
      return pred_grid
  
file_path: vision/references/depth/stereo/visualization.py
imports: import os
  from typing import List
  import numpy
  import torch
  from torch import Tensor
  from torchvision.utils import make_grid
label_desc: Use image node_id 5 for calling a global function with example usage: make_training_sample_grid(left_images, right_images, disparities, masks, predictions) and returns: pred_grid