code: def precision_recall_curve(
      preds: Tensor,
      target: Tensor,
      task: Literal["binary", "multiclass", "multilabel"],
      thresholds: Optional[Union[int, List[float], Tensor]] = None,
      num_classes: Optional[int] = None,
      num_labels: Optional[int] = None,
      average: Optional[Literal["micro", "macro"]] = None,
      ignore_index: Optional[int] = None,
      validate_args: bool = True,
  ) -> Union[
      Tuple[Tensor, Tensor, Tensor],
      Tuple[List[Tensor], List[Tensor], List[Tensor]],
  ]:
      r"""Compute the precision-recall curve.
  
      The curve consist of multiple pairs of precision and recall values evaluated at different thresholds, such that the
      tradeoff between the two values can been seen.
  
      This function is a simple wrapper to get the task specific versions of this metric, which is done by setting the
      ``task`` argument to either ``'binary'``, ``'multiclass'`` or ``multilabel``. See the documentation of
      :func:`~torchmetrics.functional.classification.binary_precision_recall_curve`,
      :func:`~torchmetrics.functional.classification.multiclass_precision_recall_curve` and
      :func:`~torchmetrics.functional.classification.multilabel_precision_recall_curve` for the specific details of each
      argument influence and examples.
  
      Legacy Example:
          >>> pred = torch.tensor([0, 0.1, 0.8, 0.4])
          >>> target = torch.tensor([0, 1, 1, 0])
          >>> precision, recall, thresholds = precision_recall_curve(pred, target, task='binary')
          >>> precision
          tensor([0.5000, 0.6667, 0.5000, 1.0000, 1.0000])
          >>> recall
          tensor([1.0000, 1.0000, 0.5000, 0.5000, 0.0000])
          >>> thresholds
          tensor([0.0000, 0.1000, 0.4000, 0.8000])
  
          >>> pred = torch.tensor([[0.75, 0.05, 0.05, 0.05, 0.05],
          ...                      [0.05, 0.75, 0.05, 0.05, 0.05],
          ...                      [0.05, 0.05, 0.75, 0.05, 0.05],
          ...                      [0.05, 0.05, 0.05, 0.75, 0.05]])
          >>> target = torch.tensor([0, 1, 3, 2])
          >>> precision, recall, thresholds = precision_recall_curve(pred, target, task='multiclass', num_classes=5)
          >>> precision
          [tensor([0.2500, 1.0000, 1.0000]), tensor([0.2500, 1.0000, 1.0000]), tensor([0.2500, 0.0000, 1.0000]),
           tensor([0.2500, 0.0000, 1.0000]), tensor([0., 1.])]
          >>> recall
          [tensor([1., 1., 0.]), tensor([1., 1., 0.]), tensor([1., 0., 0.]), tensor([1., 0., 0.]), tensor([nan, 0.])]
          >>> thresholds
          [tensor([0.0500, 0.7500]), tensor([0.0500, 0.7500]), tensor([0.0500, 0.7500]), tensor([0.0500, 0.7500]),
           tensor([0.0500])]
  
      """
      task = ClassificationTask.from_str(task)
      if task == ClassificationTask.BINARY:
          return binary_precision_recall_curve(
              preds, target, thresholds, ignore_index, validate_args
          )
      if task == ClassificationTask.MULTICLASS:
          if not isinstance(num_classes, int):
              raise ValueError(
                  f"`num_classes` is expected to be `int` but `{type(num_classes)} was passed.`"
              )
          return multiclass_precision_recall_curve(
              preds,
              target,
              num_classes,
              thresholds,
              average,
              ignore_index,
              validate_args,
          )
      if task == ClassificationTask.MULTILABEL:
          if not isinstance(num_labels, int):
              raise ValueError(
                  f"`num_labels` is expected to be `int` but `{type(num_labels)} was passed.`"
              )
          return multilabel_precision_recall_curve(
              preds,
              target,
              num_labels,
              thresholds,
              ignore_index,
              validate_args,
          )
      raise ValueError(f"Task {task} not supported.")
  
imports: from typing import List, Optional, Sequence, Tuple, Union
  import torch
  from torch import Tensor, tensor
  from torch.nn import functional
  from typing_extensions import Literal
  from torchmetrics.utilities.checks import _check_same_shape
  from torchmetrics.utilities.compute import _safe_divide, interp
  from torchmetrics.utilities.data import _bincount, _cumsum
  from torchmetrics.utilities.enums import ClassificationTask
label_desc: Use image node_id 25 for calling a global function with example usage: precision_recall_curve(preds, target, task, thresholds, num_classes, num_labels, average, ignore_index, validate_args) and returns: binary_precision_recall_curve, multiclass_precision_recall_curve, multilabel_precision_recall_curve