class_docstr: Test class for `BinaryAveragePrecision` metric.
class_docstr_tok: ["Test","class","for","`","BinaryAveragePrecision","`","metric","."]
docstr: Test functional implementation of metric.
code: def test_binary_average_precision_functional(
      self, inputs, ignore_index
  ):
      """Test functional implementation of metric."""
      preds, target = inputs
      if ignore_index is not None:
          target = inject_ignore_index(target, ignore_index)
      self.run_functional_metric_test(
          preds=preds,
          target=target,
          metric_functional=binary_average_precision,
          reference_metric=partial(
              _sklearn_avg_precision_binary, ignore_index=ignore_index
          ),
          metric_args={
              "thresholds": None,
              "ignore_index": ignore_index,
          },
      )
  
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 average_precision_score
  from torchmetrics.classification.average_precision import AveragePrecision, BinaryAveragePrecision, MulticlassAveragePrecision, MultilabelAveragePrecision
  from torchmetrics.functional.classification.average_precision import binary_average_precision, multiclass_average_precision, multilabel_average_precision
  from torchmetrics.functional.classification.precision_recall_curve import binary_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 2 for calling the TestBinaryAveragePrecision obj's underlying member method code with example usage: obj.test_binary_average_precision_functional(inputs, ignore_index) without return types