code: def test_generalized_mean(labels, p):
      """Check calculation of generalized mean for vectors of length 2."""
      for x in labels:
          print(x)
          assert np.allclose(
              calculate_generalized_mean(x, p),
              sklearn_generalized_average(x[0], x[1], average_method=p),
          )
  
file_path: torchmetrics/tests/unittests/clustering/test_utils.py
imports: import numpy
  import pytest
  import torch
  from sklearn.metrics.cluster import contingency_matrix
  from sklearn.metrics.cluster import entropy
  from sklearn.metrics.cluster import pair_confusion_matrix
  from sklearn.metrics.cluster._supervised import _generalized_average
  from torchmetrics.functional.clustering.utils import calculate_contingency_matrix, calculate_entropy, calculate_generalized_mean, calculate_pair_cluster_confusion_matrix
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
label_desc: Use image node_id 4 for calling a global function with example usage: test_generalized_mean(labels, p) without return types