code: def test_l2_distance_matrix() -> None:
      # Sanity checks using random matrices
      n = 3
      m = 7
      d = 4
      x = torch.randn(n, d)
      y = torch.randn(m, d)
      dist_matrix = l2_distance_matrix(x, y).numpy()
      assert dist_matrix.shape[0] == n
      assert dist_matrix.shape[1] == m
      assert np.all(0 <= dist_matrix)
  
      # Numerical value check
      x = torch.tensor(
          [
              [
                  3.0,
                  4.0,
                  0.0,
              ]
          ]
      )
      y = torch.tensor([[3.0, 0.0, 0.0], [0.0, 0.0, 0.0]])
      dist_matrix = l2_distance_matrix(x, y).numpy()
      assert dist_matrix.shape[0] == 1
      assert dist_matrix.shape[1] == 2
      expected_similarity_dist = np.array([[4.0, 5.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 2 for calling a global function with example usage: test_l2_distance_matrix() without return types