class_docstr: Tester class for the different intersection metrics.
docstr: Test class input validation.
docstr_tok: ["Test","class","input","validation","."]
code: def test_error_on_wrong_input(
      self, class_metric, functional_metric, reference_metric
  ):
      """Test class input validation."""
      metric = class_metric()
  
      metric.update([], [])  # no error
  
      with pytest.raises(
          ValueError,
          match="Expected argument `preds` to be of type Sequence",
      ):
          metric.update(Tensor(), [])  # type: ignore
  
      with pytest.raises(
          ValueError,
          match="Expected argument `target` to be of type Sequence",
      ):
          metric.update([], Tensor())  # type: ignore
  
      with pytest.raises(
          ValueError,
          match="Expected argument `preds` and `target` to have the same length",
      ):
          metric.update([{}], [{}, {}])
  
      with pytest.raises(
          ValueError,
          match="Expected all dicts in `preds` to contain the `boxes` key",
      ):
          metric.update(
              [{"scores": Tensor(), "labels": IntTensor}],
              [{"boxes": Tensor(), "labels": IntTensor()}],
          )
  
      with pytest.raises(
          ValueError,
          match="Expected all dicts in `preds` to contain the `labels` key",
      ):
          metric.update(
              [{"boxes": Tensor(), "scores": IntTensor}],
              [{"boxes": Tensor(), "labels": IntTensor()}],
          )
  
      with pytest.raises(
          ValueError,
          match="Expected all dicts in `target` to contain the `boxes` key",
      ):
          metric.update(
              [
                  {
                      "boxes": Tensor(),
                      "scores": IntTensor,
                      "labels": IntTensor,
                  }
              ],
              [{"labels": IntTensor()}],
          )
  
      with pytest.raises(
          ValueError,
          match="Expected all dicts in `target` to contain the `labels` key",
      ):
          metric.update(
              [
                  {
                      "boxes": Tensor(),
                      "scores": IntTensor,
                      "labels": IntTensor,
                  }
              ],
              [{"boxes": IntTensor()}],
          )
  
      with pytest.raises(
          ValueError,
          match="Expected all boxes in `preds` to be of type Tensor",
      ):
          metric.update(
              [
                  {
                      "boxes": [],
                      "scores": Tensor(),
                      "labels": IntTensor(),
                  }
              ],
              [{"boxes": Tensor(), "labels": IntTensor()}],
          )
  
      with pytest.raises(
          ValueError,
          match="Expected all labels in `preds` to be of type Tensor",
      ):
          metric.update(
              [{"boxes": Tensor(), "scores": Tensor(), "labels": []}],
              [{"boxes": Tensor(), "labels": IntTensor()}],
          )
  
      with pytest.raises(
          ValueError,
          match="Expected all boxes in `target` to be of type Tensor",
      ):
          metric.update(
              [
                  {
                      "boxes": Tensor(),
                      "scores": Tensor(),
                      "labels": IntTensor(),
                  }
              ],
              [{"boxes": [], "labels": IntTensor()}],
          )
  
      with pytest.raises(
          ValueError,
          match="Expected all labels in `target` to be of type Tensor",
      ):
          metric.update(
              [
                  {
                      "boxes": Tensor(),
                      "scores": Tensor(),
                      "labels": IntTensor(),
                  }
              ],
              [{"boxes": Tensor(), "labels": []}],
          )
  
imports: from functools import partial
  import pytest
  import torch
  from torch import IntTensor, Tensor
  from torchmetrics.detection.ciou import CompleteIntersectionOverUnion
  from torchmetrics.detection.diou import DistanceIntersectionOverUnion
  from torchmetrics.detection.giou import GeneralizedIntersectionOverUnion
  from torchmetrics.detection.iou import IntersectionOverUnion
  from torchmetrics.functional.detection.ciou import complete_intersection_over_union
  from torchmetrics.functional.detection.diou import distance_intersection_over_union
  from torchmetrics.functional.detection.giou import generalized_intersection_over_union
  from torchmetrics.functional.detection.iou import intersection_over_union
  from torchmetrics.utilities.imports import _TORCHVISION_GREATER_EQUAL_0_13
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 3 for calling the TestIntersectionMetrics obj's underlying member method code with example usage: obj.test_error_on_wrong_input(class_metric, functional_metric, reference_metric) without return types