code: def _sklearn_fbeta_score_multilabel(
      preds, target, sk_fn, ignore_index, multidim_average, 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 None and multidim_average == "global":
          return sk_fn(
              target.transpose(0, 2, 1).reshape(-1, NUM_CLASSES),
              preds.transpose(0, 2, 1).reshape(-1, NUM_CLASSES),
              average=average,
          )
      if multidim_average == "global":
          return _sklearn_fbeta_score_multilabel_global(
              preds, target, sk_fn, ignore_index, average
          )
      return _sklearn_fbeta_score_multilabel_local(
          preds, target, sk_fn, ignore_index, average
      )
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.metrics import confusion_matrix
  from sklearn.metrics import f1_score
  from sklearn.metrics import fbeta_score
  from torch import Tensor
  from torchmetrics.classification.f_beta import BinaryF1Score, BinaryFBetaScore, F1Score, FBetaScore, MulticlassF1Score, MulticlassFBetaScore, MultilabelF1Score, MultilabelFBetaScore
  from torchmetrics.functional.classification.f_beta import binary_f1_score, binary_fbeta_score, multiclass_f1_score, multiclass_fbeta_score, multilabel_f1_score, multilabel_fbeta_score
  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 6 for calling a global function with example usage: _sklearn_fbeta_score_multilabel(preds, target, sk_fn, ignore_index, multidim_average, average) and returns: _sklearn_fbeta_score_multilabel_local, sk_fn, _sklearn_fbeta_score_multilabel_global