code: def test_psnr(test_data, available_device):
      y_pred, y = test_data
      data_range = (y.max() - y.min()).cpu().item()
  
      psnr = PSNR(data_range=data_range, device=available_device)
      psnr.update(test_data)
      psnr_compute = psnr.compute()
  
      np_y_pred = y_pred.cpu().numpy()
      np_y = y.cpu().numpy()
      np_psnr = 0
      for np_y_pred_, np_y_ in zip(np_y_pred, np_y):
          np_psnr += ski_psnr(np_y_, np_y_pred_, data_range=data_range)
  
      assert psnr_compute > 0.0
      assert isinstance(psnr_compute, float)
      assert np.allclose(psnr_compute, np_psnr / np_y.shape[0])
  
file_path: ignite/tests/ignite/metrics/test_psnr.py
imports: import numpy
  import pytest
  import torch
  from skimage.metrics import peak_signal_noise_ratio
  import ignite.distributed
  from ignite.engine import Engine
  from ignite.exceptions import NotComputableError
  from ignite.metrics import PSNR
  from ignite.utils import manual_seed
label_desc: Use image node_id 4 for calling a global function with example usage: test_psnr(test_data, available_device) without return types