code: def test_multidimensional_contingency_error():
      """Check that contingency matrix is not calculated for multidimensional input."""
      with pytest.raises(ValueError, match="Expected 1d*"):
          calculate_contingency_matrix(
              _multi_dim_inputs.preds, _multi_dim_inputs.target
          )
  
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 2 for calling a global function with example usage: test_multidimensional_contingency_error() without return types