class_docstr: Test class for `MulticlassSpecificity` metric.
class_docstr_tok: ["Test","class","for","`","MulticlassSpecificity","`","metric","."]
docstr: Test class implementation of metric.
docstr_tok: ["Test","class","implementation","of","metric","."]
code: def test_multiclass_specificity(
      self, ddp, inputs, ignore_index, multidim_average, average
  ):
      """Test class implementation of metric."""
      preds, target = inputs
      if ignore_index == -1:
          target = inject_ignore_index(target, ignore_index)
      if multidim_average == "samplewise" and target.ndim < 3:
          pytest.skip(
              "samplewise and non-multidim arrays are not valid"
          )
      if multidim_average == "samplewise" and ddp:
          pytest.skip(
              "samplewise and ddp give different order than non ddp"
          )
  
      self.run_class_metric_test(
          ddp=ddp,
          preds=preds,
          target=target,
          metric_class=MulticlassSpecificity,
          reference_metric=partial(
              _baseline_specificity_multiclass,
              ignore_index=ignore_index,
              multidim_average=multidim_average,
              average=average,
          ),
          metric_args={
              "ignore_index": ignore_index,
              "multidim_average": multidim_average,
              "average": average,
              "num_classes": NUM_CLASSES,
          },
      )
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.metrics import confusion_matrix
  from torch import Tensor, tensor
  from torchmetrics.classification.specificity import BinarySpecificity, MulticlassSpecificity, MultilabelSpecificity, Specificity
  from torchmetrics.functional.classification.specificity import binary_specificity, multiclass_specificity, multilabel_specificity
  from torchmetrics.metric import Metric
  from unittests import NUM_CLASSES, THRESHOLD
  from unittests.classification.inputs import _binary_cases, _multiclass_cases, _multilabel_cases
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester, inject_ignore_index
label_desc: Use image node_id 1 for calling the TestMulticlassSpecificity obj's underlying member method code with example usage: obj.test_multiclass_specificity(ddp, inputs, ignore_index, multidim_average, average) without return types