code: def roc(
      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 Receiver Operating Characteristic (ROC).
  
      The curve consist of multiple pairs of true positive rate (TPR) and false positive rate (FPR) values evaluated at
      different thresholds, such that the tradeoff between the two values can be 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_roc`,
      :func:`~torchmetrics.functional.classification.multiclass_roc` and
      :func:`~torchmetrics.functional.classification.multilabel_roc` for the specific details of each argument
      influence and examples.
  
      Legacy Example:
          >>> pred = torch.tensor([0.0, 1.0, 2.0, 3.0])
          >>> target = torch.tensor([0, 1, 1, 1])
          >>> fpr, tpr, thresholds = roc(pred, target, task='binary')
          >>> fpr
          tensor([0., 0., 0., 0., 1.])
          >>> tpr
          tensor([0.0000, 0.3333, 0.6667, 1.0000, 1.0000])
          >>> thresholds
          tensor([1.0000, 0.9526, 0.8808, 0.7311, 0.5000])
  
          >>> pred = torch.tensor([[0.75, 0.05, 0.05, 0.05],
          ...                      [0.05, 0.75, 0.05, 0.05],
          ...                      [0.05, 0.05, 0.75, 0.05],
          ...                      [0.05, 0.05, 0.05, 0.75]])
          >>> target = torch.tensor([0, 1, 3, 2])
          >>> fpr, tpr, thresholds = roc(pred, target, task='multiclass', num_classes=4)
          >>> fpr
          [tensor([0., 0., 1.]), tensor([0., 0., 1.]), tensor([0.0000, 0.3333, 1.0000]), tensor([0.0000, 0.3333, 1.0000])]
          >>> tpr
          [tensor([0., 1., 1.]), tensor([0., 1., 1.]), tensor([0., 0., 1.]), tensor([0., 0., 1.])]
          >>> thresholds
          [tensor([1.0000, 0.7500, 0.0500]),
           tensor([1.0000, 0.7500, 0.0500]),
           tensor([1.0000, 0.7500, 0.0500]),
           tensor([1.0000, 0.7500, 0.0500])]
  
          >>> pred = torch.tensor([[0.8191, 0.3680, 0.1138],
          ...                      [0.3584, 0.7576, 0.1183],
          ...                      [0.2286, 0.3468, 0.1338],
          ...                      [0.8603, 0.0745, 0.1837]])
          >>> target = torch.tensor([[1, 1, 0], [0, 1, 0], [0, 0, 0], [0, 1, 1]])
          >>> fpr, tpr, thresholds = roc(pred, target, task='multilabel', num_labels=3)
          >>> fpr
          [tensor([0.0000, 0.3333, 0.3333, 0.6667, 1.0000]),
           tensor([0., 0., 0., 1., 1.]),
           tensor([0.0000, 0.0000, 0.3333, 0.6667, 1.0000])]
          >>> tpr
          [tensor([0., 0., 1., 1., 1.]), tensor([0.0000, 0.3333, 0.6667, 0.6667, 1.0000]), tensor([0., 1., 1., 1., 1.])]
          >>> thresholds
          [tensor([1.0000, 0.8603, 0.8191, 0.3584, 0.2286]),
           tensor([1.0000, 0.7576, 0.3680, 0.3468, 0.0745]),
           tensor([1.0000, 0.1837, 0.1338, 0.1183, 0.1138])]
  
      """
      task = ClassificationTask.from_str(task)
      if task == ClassificationTask.BINARY:
          return binary_roc(
              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_roc(
              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_roc(
              preds,
              target,
              num_labels,
              thresholds,
              ignore_index,
              validate_args,
          )
      raise ValueError(
          f"Task {task} not supported, expected one of {ClassificationTask}."
      )
  
file_path: torchmetrics/src/torchmetrics/functional/classification/roc.py
imports: from typing import List, Optional, Tuple, Union
  import torch
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics.functional.classification.precision_recall_curve import _binary_clf_curve, _binary_precision_recall_curve_arg_validation, _binary_precision_recall_curve_format, _binary_precision_recall_curve_tensor_validation, _binary_precision_recall_curve_update, _multiclass_precision_recall_curve_arg_validation, _multiclass_precision_recall_curve_format, _multiclass_precision_recall_curve_tensor_validation, _multiclass_precision_recall_curve_update, _multilabel_precision_recall_curve_arg_validation, _multilabel_precision_recall_curve_format, _multilabel_precision_recall_curve_tensor_validation, _multilabel_precision_recall_curve_update
  from torchmetrics.utilities import rank_zero_warn
  from torchmetrics.utilities.compute import _safe_divide, interp
  from torchmetrics.utilities.enums import ClassificationTask
label_desc: Use image node_id 7 for calling a global function with example usage: roc(preds, target, task, thresholds, num_classes, num_labels, average, ignore_index, validate_args) and returns: binary_roc, multiclass_roc, multilabel_roc