code: def _baseline_exact_match_multilabel(
      preds, target, ignore_index, multidim_average
  ):
      preds = preds.numpy()
      target = target.numpy()
      if np.issubdtype(preds.dtype, np.floating):
          if not ((preds > 0) & (preds < 1)).all():
              preds = sigmoid(preds)
          preds = (preds >= THRESHOLD).astype(np.uint8)
      preds = preds.reshape(*preds.shape[:2], -1)
      target = target.reshape(*target.shape[:2], -1)
  
      if ignore_index is not None:
          target = np.copy(target)
          target[target == ignore_index] = -1
  
      if multidim_average == "global":
          preds = np.moveaxis(preds, 1, -1).reshape(-1, NUM_CLASSES)
          target = np.moveaxis(target, 1, -1).reshape(-1, NUM_CLASSES)
          correct = ((preds == target).sum(1) == NUM_CLASSES).sum()
          total = preds.shape[0]
      else:
          correct = ((preds == target).sum(1) == NUM_CLASSES).sum(1)
          total = preds.shape[2]
      return correct / total
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from torchmetrics.classification.exact_match import ExactMatch, MulticlassExactMatch, MultilabelExactMatch
  from torchmetrics.functional.classification.exact_match import multiclass_exact_match, multilabel_exact_match
  from torchmetrics.metric import Metric
  from unittests import NUM_CLASSES, THRESHOLD
  from unittests.classification.inputs import _multiclass_cases, _multilabel_cases
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester, inject_ignore_index
label_desc: Use image node_id 2 for calling a global function with example usage: _baseline_exact_match_multilabel(preds, target, ignore_index, multidim_average) and returns: unknown