code: def test_cosine_distance_matrix() -> None:
      # Sanity checks using random matrices
      n = 10
      m = 15
      d = 8
      x = torch.randn(n, d)
      y = torch.randn(m, d)
      dist_matrix = cosine_distance_matrix(x, y).numpy()
      assert dist_matrix.shape[0] == n
      assert dist_matrix.shape[1] == m
      assert np.all(0 <= dist_matrix)
      assert np.all(dist_matrix <= 2)
  
      # Numerical value check
      x = torch.tensor([[1.0, 2.0, 3.0], [-1.0, -2.0, -3.0]])
      y = torch.tensor([[0.1, 0.2, 0.3], [0.0, 0.0, 0.0]])
      dist_matrix = cosine_distance_matrix(x, y).numpy()
      assert dist_matrix.shape[0] == 2
      assert dist_matrix.shape[1] == 2
      expected_similarity_dist = np.array([[0.0, 1.0], [2.0, 1.0]])
      np.testing.assert_almost_equal(
          dist_matrix, expected_similarity_dist
      )
  
file_path: ml-cvnets/tests/metrics/test_retrieval_cmc_metrics.py
imports: import argparse
  import numpy
  import pytest
  import torch
  from metrics.retrieval_cmc import RetrievalCMC, cmc_calculation, cosine_distance_matrix, l2_distance_matrix, mean_ap
label_desc: Use image node_id 1 for calling a global function with example usage: test_cosine_distance_matrix() without return types