code: def test_error_on_wrong_shapes(metric):
      """Test errors are raised on wrong input."""
      with pytest.raises(
          ValueError, match="Expected argument `x` to be a 2D tensor .*"
      ):
          metric(torch.randn(10))
  
      with pytest.raises(
          ValueError, match="Expected argument `y` to be a 2D tensor .*"
      ):
          metric(torch.randn(10, 5), torch.randn(5, 3))
  
      with pytest.raises(
          ValueError, match="Expected reduction to be one of .*"
      ):
          metric(torch.randn(10, 5), torch.randn(10, 5), reduction=1)
  
file_path: torchmetrics/tests/unittests/pairwise/test_pairwise_distance.py
imports: from functools import partial
  from typing import NamedTuple
  import pytest
  import torch
  from sklearn.metrics.pairwise import cosine_similarity, euclidean_distances, linear_kernel, manhattan_distances, pairwise_distances
  from torch import Tensor
  from torchmetrics.functional import pairwise_cosine_similarity, pairwise_euclidean_distance, pairwise_linear_similarity, pairwise_manhattan_distance, pairwise_minkowski_distance
  from unittests import BATCH_SIZE, NUM_BATCHES
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 2 for calling a global function with example usage: test_error_on_wrong_shapes(metric) without return types