code: def calculate_psnr(img1, img2, border=0):
      # img1 and img2 have range [0, 255]
      # img1 = img1.squeeze()
      # img2 = img2.squeeze()
      if not img1.shape == img2.shape:
          raise ValueError(
              "Input images must have the same dimensions."
          )
      h, w = img1.shape[:2]
      img1 = img1[border : h - border, border : w - border]
      img2 = img2[border : h - border, border : w - border]
  
      img1 = img1.astype(np.float64)
      img2 = img2.astype(np.float64)
      mse = np.mean((img1 - img2) ** 2)
      if mse == 0:
          return float("inf")
      return 20 * math.log10(255.0 / math.sqrt(mse))
  
imports: import math
  import os
  import random
  from datetime import datetime
  import cv2
  import numpy
  import torch
  from torchvision.utils import make_grid
label_desc: Use image node_id 43 for calling a global function with example usage: calculate_psnr(img1, img2, border) and returns: unknown, float