code: def _multiclass_exact_match_update(
      preds: Tensor,
      target: Tensor,
      multidim_average: Literal["global", "samplewise"] = "global",
      ignore_index: Optional[int] = None,
  ) -> Tuple[Tensor, Tensor]:
      """Compute the statistics."""
      if ignore_index is not None:
          preds = preds.clone()
          preds[target == ignore_index] = ignore_index
  
      correct = (preds == target).sum(1) == preds.shape[1]
      correct = (
          correct if multidim_average == "samplewise" else correct.sum()
      )
      total = torch.tensor(
          preds.shape[0] if multidim_average == "global" else 1,
          device=correct.device,
      )
      return correct, total
  
file_path: torchmetrics/src/torchmetrics/functional/classification/exact_match.py
imports: from typing import Optional, Tuple
  import torch
  from torch import Tensor
  from typing_extensions import Literal
  from torchmetrics.functional.classification.stat_scores import _multiclass_stat_scores_arg_validation, _multiclass_stat_scores_format, _multiclass_stat_scores_tensor_validation, _multilabel_stat_scores_arg_validation, _multilabel_stat_scores_format, _multilabel_stat_scores_tensor_validation
  from torchmetrics.utilities.compute import _safe_divide
  from torchmetrics.utilities.enums import ClassificationTaskNoBinary
label_desc: Use image node_id 2 for calling a global function with example usage: _multiclass_exact_match_update(preds, target, multidim_average, ignore_index) and returns: correct,  total