code: def _multilabel_auroc_compute(
      state: Union[Tensor, Tuple[Tensor, Tensor]],
      num_labels: int,
      average: Optional[Literal["micro", "macro", "weighted", "none"]],
      thresholds: Optional[Tensor],
      ignore_index: Optional[int] = None,
  ) -> Tensor:
      if average == "micro":
          if isinstance(state, Tensor) and thresholds is not None:
              return _binary_auroc_compute(
                  state.sum(1), thresholds, max_fpr=None
              )
  
          preds = state[0].flatten()
          target = state[1].flatten()
          if ignore_index is not None:
              idx = target == ignore_index
              preds = preds[~idx]
              target = target[~idx]
          return _binary_auroc_compute(
              (preds, target), thresholds, max_fpr=None
          )
  
      fpr, tpr, _ = _multilabel_roc_compute(
          state, num_labels, thresholds, ignore_index
      )
      return _reduce_auroc(
          fpr,
          tpr,
          average,
          weights=(state[1] == 1).sum(dim=0).float()
          if thresholds is None
          else state[0][:, 1, :].sum(-1),
      )
  
imports: from typing import List, Optional, Tuple, Union
  import torch
  from torch import Tensor, tensor
  from typing_extensions import Literal
  from torchmetrics.functional.classification.precision_recall_curve import _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.functional.classification.roc import _binary_roc_compute, _multiclass_roc_compute, _multilabel_roc_compute
  from torchmetrics.utilities.compute import _auc_compute_without_check, _safe_divide
  from torchmetrics.utilities.data import _bincount
  from torchmetrics.utilities.enums import ClassificationTask
  from torchmetrics.utilities.prints import rank_zero_warn
label_desc: Use image node_id 9 for calling a global function with example usage: _multilabel_auroc_compute(state, num_labels, average, thresholds, ignore_index) and returns: _reduce_auroc, _binary_auroc_compute, _binary_auroc_compute