class_docstr: Test class for `MulticlassPrecisionRecallCurve` metric.
class_docstr_tok: ["Test","class","for","`","MulticlassPrecisionRecallCurve","`","metric","."]
docstr: Test that the average argument works as expected.
docstr_tok: ["Test","that","the","average","argument","works","as","expected","."]
code: def test_multiclass_average(self, inputs, average, thresholds):
      """Test that the average argument works as expected."""
      preds, target = inputs
      output = multiclass_precision_recall_curve(
          preds[0],
          target[0],
          num_classes=NUM_CLASSES,
          thresholds=thresholds,
          average=average,
      )
      assert all(isinstance(o, torch.Tensor) for o in output)
      none_output = multiclass_precision_recall_curve(
          preds[0],
          target[0],
          num_classes=NUM_CLASSES,
          thresholds=thresholds,
          average=None,
      )
      if average == "macro":
          assert len(output[0]) == len(none_output[0][0]) * NUM_CLASSES
          assert len(output[1]) == len(none_output[1][0]) * NUM_CLASSES
          assert (
              len(output[2])
              == (
                  len(none_output[2][0])
                  if thresholds is None
                  else len(none_output[2])
              )
              * NUM_CLASSES
          )
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from scipy.special import softmax
  from sklearn.metrics import precision_recall_curve
  from torchmetrics.classification.precision_recall_curve import BinaryPrecisionRecallCurve, MulticlassPrecisionRecallCurve, MultilabelPrecisionRecallCurve, PrecisionRecallCurve
  from torchmetrics.functional.classification.precision_recall_curve import binary_precision_recall_curve, multiclass_precision_recall_curve, multilabel_precision_recall_curve
  from torchmetrics.metric import Metric
  from unittests import NUM_CLASSES
  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, remove_ignore_index
label_desc: Use image node_id 8 for calling the TestMulticlassPrecisionRecallCurve obj's underlying member method code with example usage: obj.test_multiclass_average(inputs, average, thresholds) without return types