code: def test_corner_case():
      """Issue: https://github.com/Lightning-AI/torchmetrics/issues/1664."""
      target = torch.tensor([2, 1, 0, 0])
      preds = torch.tensor([2, 1, 0, 1])
      for i in range(3, 9):
          f1_score = MulticlassF1Score(num_classes=i, average="macro")
          res = f1_score(preds, target)
          assert res == torch.tensor([0.77777779])
  
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 7 for calling a global function with example usage: test_corner_case() without return types