code: def _ref_metric(preds, target):
      """Reference implementation of PSNRB metric.
  
      Inspired by
      https://github.com/andrewekhalel/sewar/blob/master/sewar/full_ref.py
      that also supports batched inputs.
  
      """
      preds = preds.numpy()
      target = target.numpy()
      imdff = np.double(target) - np.double(preds)
  
      mse = np.mean(np.square(imdff.flatten()))
      bef = sum([_compute_bef(p.squeeze()) for p in preds])
      mse_b = mse + bef
  
      if np.amax(preds) > 2:
          psnr_b = 10 * math.log10(
              (target.max() - target.min()) ** 2 / mse_b
          )
      else:
          psnr_b = 10 * math.log10(1 / mse_b)
  
      return psnr_b
  
file_path: torchmetrics/tests/unittests/image/test_psnrb.py
imports: import math
  import numpy
  import pytest
  import torch
  from sewar.utils import _compute_bef
  from torchmetrics.functional.image.psnrb import peak_signal_noise_ratio_with_blocked_effect
  from torchmetrics.image import PeakSignalNoiseRatioWithBlockedEffect
  from unittests import BATCH_SIZE, NUM_BATCHES
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 1 for calling a global function with example usage: _ref_metric(preds, target) and returns: psnr_b