code: def test_error_on_non_2d_input():
      """Test that error is raised if input is not 2-dimensional."""
      metric = CosineSimilarity()
      with pytest.raises(
          ValueError,
          match="Expected input to cosine similarity to be 2D tensors of shape.*",
      ):
          metric(torch.randn(100), torch.randn(100))
  
file_path: torchmetrics/tests/unittests/regression/test_cosine_similarity.py
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from sklearn.metrics.pairwise import cosine_similarity
  from torchmetrics.functional.regression.cosine_similarity import cosine_similarity
  from torchmetrics.regression.cosine_similarity import CosineSimilarity
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 3 for calling a global function with example usage: test_error_on_non_2d_input() without return types