code: def _sklearn_matthews_corrcoef_multilabel(
      preds, target, ignore_index=None
  ):
      preds = preds.view(-1).numpy()
      target = target.view(-1).numpy()
      if np.issubdtype(preds.dtype, np.floating):
          if not ((preds > 0) & (preds < 1)).all():
              preds = sigmoid(preds)
          preds = (preds >= THRESHOLD).astype(np.uint8)
      target, preds = remove_ignore_index(target, preds, ignore_index)
      return sk_matthews_corrcoef(y_true=target, y_pred=preds)
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.metrics import matthews_corrcoef
  from torchmetrics.classification.matthews_corrcoef import BinaryMatthewsCorrCoef, MatthewsCorrCoef, MulticlassMatthewsCorrCoef, MultilabelMatthewsCorrCoef
  from torchmetrics.functional.classification.matthews_corrcoef import binary_matthews_corrcoef, multiclass_matthews_corrcoef, multilabel_matthews_corrcoef
  from torchmetrics.metric import Metric
  from unittests import NUM_CLASSES, THRESHOLD
  from unittests.classification.inputs import _binary_cases, _multiclass_cases, _multilabel_cases
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester, inject_ignore_index, remove_ignore_index
label_desc: Use image node_id 3 for calling a global function with example usage: _sklearn_matthews_corrcoef_multilabel(preds, target, ignore_index) and returns: sk_matthews_corrcoef