def METHOD_NAME(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)
        ]
    )