class_docstr: Test class for PSNRB metric.
class_docstr_tok: ["Test","class","for","PSNRB","metric","."]
docstr: Test that PSNRB metric works with half precision on cpu.
docstr_tok: ["Test","that","PSNRB","metric","works","with","half","precision","on","cpu","."]
code: def test_psnr_half_cpu(self, preds, target):
      """Test that PSNRB metric works with half precision on cpu."""
      if target.max() - target.min() < 2:
          pytest.xfail(
              "PSNRB metric does not support cpu + half precision"
          )
      self.run_precision_test_cpu(
          preds,
          target,
          PeakSignalNoiseRatioWithBlockedEffect,
          peak_signal_noise_ratio_with_blocked_effect,
      )
  
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 3 for calling the TestPSNR obj's underlying member method code with example usage: obj.test_psnr_half_cpu(preds, target) without return types