code: def _skimage_psnr(preds, target, data_range, reduction, dim):
      if isinstance(data_range, tuple):
          preds = preds.clamp(min=data_range[0], max=data_range[1])
          target = target.clamp(min=data_range[0], max=data_range[1])
          data_range = data_range[1] - data_range[0]
      sk_preds_lists = _to_sk_peak_signal_noise_ratio_inputs(
          preds, dim=dim
      )
      sk_target_lists = _to_sk_peak_signal_noise_ratio_inputs(
          target, dim=dim
      )
      np_reduce_map = {
          "elementwise_mean": np.mean,
          "none": np.array,
          "sum": np.sum,
      }
      return np_reduce_map[reduction](
          [
              skimage_peak_signal_noise_ratio(
                  sk_target, sk_preds, data_range=data_range
              )
              for sk_target, sk_preds in zip(
                  sk_target_lists, sk_preds_lists
              )
          ]
      )
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from skimage.metrics import peak_signal_noise_ratio
  from torchmetrics.functional import peak_signal_noise_ratio
  from torchmetrics.image import PeakSignalNoiseRatio
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_2_1
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 2 for calling a global function with example usage: _skimage_psnr(preds, target, data_range, reduction, dim) and returns: np_reduce_map