code: def test_error_on_wrong_input():
      """Test class input validation."""
      with pytest.raises(
          TypeError,
          match="Expected argument `stuffs` to contain `int` categories.*",
      ):
          PanopticQuality(things={0}, stuffs={"sky"})
  
      with pytest.raises(
          ValueError,
          match="Expected arguments `things` and `stuffs` to have distinct keys.*",
      ):
          PanopticQuality(things={0}, stuffs={0})
  
      metric = PanopticQuality(
          things={0, 1, 3},
          stuffs={2, 8},
          allow_unknown_preds_category=True,
      )
      valid_images = torch.randint(low=0, high=9, size=(8, 64, 64, 2))
      metric.update(valid_images, valid_images)
      valid_point_clouds = torch.randint(
          low=0, high=9, size=(1, 100, 2)
      )
      metric.update(valid_point_clouds, valid_point_clouds)
  
      with pytest.raises(
          TypeError,
          match="Expected argument `preds` to be of type `torch.Tensor`.*",
      ):
          metric.update([], valid_images)
  
      with pytest.raises(
          TypeError,
          match="Expected argument `target` to be of type `torch.Tensor`.*",
      ):
          metric.update(valid_images, [])
  
      preds = torch.randint(low=0, high=9, size=(2, 400, 300, 2))
      target = torch.randint(low=0, high=9, size=(2, 30, 40, 2))
      with pytest.raises(
          ValueError,
          match="Expected argument `preds` and `target` to have the same shape.*",
      ):
          metric.update(preds, target)
  
      preds = torch.randint(low=0, high=9, size=(1, 2))
      with pytest.raises(
          ValueError,
          match="Expected argument `preds` to have at least one spatial dimension.*",
      ):
          metric.update(preds, preds)
  
      preds = torch.randint(low=0, high=9, size=(1, 64, 64, 8))
      with pytest.raises(
          ValueError,
          match="Expected argument `preds` to have exactly 2 channels in the last dimension.*",
      ):
          metric.update(preds, preds)
  
      metric = PanopticQuality(
          things=[0], stuffs=[1], allow_unknown_preds_category=False
      )
      preds = torch.randint(low=0, high=1, size=(1, 100, 2))
      preds[0, 0, 0] = 2
      with pytest.raises(
          ValueError, match="Unknown categories found.*"
      ):
          metric.update(preds, preds)
  
file_path: torchmetrics/tests/unittests/detection/test_panoptic_quality.py
imports: from typing import Any, Dict
  import numpy
  import pytest
  import torch
  from torchmetrics.detection.panoptic_qualities import PanopticQuality
  from torchmetrics.functional.detection.panoptic_qualities import panoptic_quality
  from unittests import _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 5 for calling a global function with example usage: test_error_on_wrong_input() without return types