code: def process_non_loss_data(data, iteration, writer):
      psnr_sum = 0
      ssim_sum = 0
      for output_tb, ssim, psnr in data:
          output_tb[output_tb < 0] = 0
          output_tb[output_tb > 1] = 1
          writer.add_images(
              "gt-input-output-vald",
              output_tb,
              global_step=iteration,
              walltime=None,
              dataformats="NCHW",
          )
          psnr_sum = psnr_sum + psnr.item()
          ssim_sum = ssim_sum + ssim.item()
      psnr = psnr_sum / len(data)
      ssim = ssim_sum / len(data)
      writer.add_scalar(
          "PSNR generate value-validation", psnr, iteration
      )
      writer.add_scalar(
          "SSIM generate value-validation", ssim, iteration
      )
  
file_path: megatron-lm/pretrain_vision_inpaint.py
imports: import torch
  import torch.nn.functional
  from functools import partial
  from megatron import get_args, get_timers, print_rank_0, print_rank_last
  from megatron.core.enums import ModelType
  from megatron.data.vit_dataset import build_train_valid_datasets
  from megatron.model.vision.inpainting import VitInpaintingModel
  from megatron.model.vision.inpainting import MitInpaintingModel
  from megatron.training import pretrain
  from megatron.utils import average_losses_across_data_parallel_group
  from tasks.vision.segmentation.metrics import SSIM, PSNR
  from megatron.arguments import core_transformer_config_from_args
label_desc: Use image node_id 5 for calling a global function with example usage: process_non_loss_data(data, iteration, writer) without return types