code: def test_multiclass_overflow():
      """Test that multiclass computations does not overflow even on byte input."""
      preds = torch.randint(20, (100,)).byte()
      target = torch.randint(20, (100,)).byte()
  
      m = MulticlassStatScores(num_classes=20, average=None)
      res = m(preds, target)
  
      confmat = sk_confusion_matrix(target, preds)
      fp = confmat.sum(axis=0) - np.diag(confmat)
      fn = confmat.sum(axis=1) - np.diag(confmat)
      tp = np.diag(confmat)
      tn = confmat.sum() - (fp + fn + tp)
      compare = np.stack([tp, fp, tn, fn, tp + fn]).T
  
      assert torch.allclose(res, torch.tensor(compare))
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.metrics import confusion_matrix
  from torchmetrics.classification.stat_scores import BinaryStatScores, MulticlassStatScores, MultilabelStatScores, StatScores
  from torchmetrics.functional.classification.stat_scores import binary_stat_scores, multiclass_stat_scores, multilabel_stat_scores
  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_multiclass_overflow() without return types