code: def test_compute_on_different_dtype():
      """Check that extraction of compute groups are robust towards difference in dtype."""
      m = MetricCollection(
          [
              MulticlassConfusionMatrix(num_classes=3),
              MulticlassMatthewsCorrCoef(num_classes=3),
          ]
      )
      assert not m._groups_checked
      assert m.compute_groups == {
          0: ["MulticlassConfusionMatrix"],
          1: ["MulticlassMatthewsCorrCoef"],
      }
      preds = torch.randn(10, 3).softmax(dim=-1)
      target = torch.randint(3, (10,))
      for _ in range(2):
          m.update(preds, target)
      assert m.compute_groups == {
          0: ["MulticlassConfusionMatrix", "MulticlassMatthewsCorrCoef"]
      }
      assert m.compute()
  
imports: import pickle
  from copy import deepcopy
  from typing import Any
  import pytest
  import torch
  from torchmetrics import Metric, MetricCollection
  from torchmetrics.classification import BinaryAccuracy, MulticlassAccuracy, MulticlassAUROC, MulticlassAveragePrecision, MulticlassCohenKappa, MulticlassConfusionMatrix, MulticlassF1Score, MulticlassMatthewsCorrCoef, MulticlassPrecision, MulticlassRecall, MultilabelAUROC, MultilabelAveragePrecision
  from torchmetrics.utilities.checks import _allclose_recursive
  from unittests.helpers import seed_all
  from unittests.helpers.testers import DummyMetricDiff, DummyMetricMultiOutputDict, DummyMetricSum
label_desc: Use image node_id 12 for calling a global function with example usage: test_compute_on_different_dtype() without return types