code: def multilabel_confusion_matrix(
      preds: Tensor,
      target: Tensor,
      num_labels: int,
      threshold: float = 0.5,
      normalize: Optional[
          Literal["true", "pred", "all", "none"]
      ] = None,
      ignore_index: Optional[int] = None,
      validate_args: bool = True,
  ) -> Tensor:
      r"""Compute the `confusion matrix`_ for multilabel tasks.
  
      Accepts the following input tensors:
  
      - ``preds`` (int or float tensor): ``(N, C, ...)``. If preds is a floating point tensor with values outside
        [0,1] range we consider the input to be logits and will auto apply sigmoid per element. Additionally,
        we convert to int tensor with thresholding using the value in ``threshold``.
      - ``target`` (int tensor): ``(N, C, ...)``
  
      Additional dimension ``...`` will be flattened into the batch dimension.
  
      Args:
          preds: Tensor with predictions
          target: Tensor with true labels
          num_labels: Integer specifying the number of labels
          threshold: Threshold for transforming probability to binary (0,1) predictions
          normalize: Normalization mode for confusion matrix. Choose from:
  
              - ``None`` or ``'none'``: no normalization (default)
              - ``'true'``: normalization over the targets (most commonly used)
              - ``'pred'``: normalization over the predictions
              - ``'all'``: normalization over the whole matrix
          ignore_index:
              Specifies a target value that is ignored and does not contribute to the metric calculation
          validate_args: bool indicating if input arguments and tensors should be validated for correctness.
              Set to ``False`` for faster computations.
  
      Returns:
          A ``[num_labels, 2, 2]`` tensor
  
      Example (preds is int tensor):
          >>> from torch import tensor
          >>> from torchmetrics.functional.classification import multilabel_confusion_matrix
          >>> target = tensor([[0, 1, 0], [1, 0, 1]])
          >>> preds = tensor([[0, 0, 1], [1, 0, 1]])
          >>> multilabel_confusion_matrix(preds, target, num_labels=3)
          tensor([[[1, 0], [0, 1]],
                  [[1, 0], [1, 0]],
                  [[0, 1], [0, 1]]])
  
      Example (preds is float tensor):
          >>> from torchmetrics.functional.classification import multilabel_confusion_matrix
          >>> target = tensor([[0, 1, 0], [1, 0, 1]])
          >>> preds = tensor([[0.11, 0.22, 0.84], [0.73, 0.33, 0.92]])
          >>> multilabel_confusion_matrix(preds, target, num_labels=3)
          tensor([[[1, 0], [0, 1]],
                  [[1, 0], [1, 0]],
                  [[0, 1], [0, 1]]])
  
      """
      if validate_args:
          _multilabel_confusion_matrix_arg_validation(
              num_labels, threshold, ignore_index, normalize
          )
          _multilabel_confusion_matrix_tensor_validation(
              preds, target, num_labels, ignore_index
          )
      preds, target = _multilabel_confusion_matrix_format(
          preds, target, num_labels, threshold, ignore_index
      )
      confmat = _multilabel_confusion_matrix_update(
          preds, target, num_labels
      )
      return _multilabel_confusion_matrix_compute(confmat, normalize)
  
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics.utilities.checks import _check_same_shape
  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 19 for calling a global function with example usage: multilabel_confusion_matrix(preds, target, num_labels, threshold, normalize, ignore_index, validate_args) and returns: _multilabel_confusion_matrix_compute