code: def test_pairwise_similarity_zero():
      eps = 1e-8
      # Numpy
      embeddings1_np = np.random.randn(2, 3, 7).astype(np.float32)
      embeddings2_np = np.random.randn(2, 5, 7).astype(np.float32)
  
      embeddings1_np[0, 1] = 0.0  # Zero out one embedding
  
      # PyTorch
      embeddings1_th = torch.as_tensor(embeddings1_np)
      embeddings2_th = torch.as_tensor(embeddings2_np)
  
      similarities_th = pairwise_cosine_similarity(
          embeddings1_th, embeddings2_th, eps=eps
      )
  
      assert similarities_th.shape == (2, 3, 5)
  
      norm1_np = np.sqrt(np.sum(embeddings1_np**2, axis=2))
      norm2_np = np.sqrt(np.sum(embeddings2_np**2, axis=2))
      similarities_np = np.zeros((2, 3, 5), dtype=np.float32)
      for i in range(2):
          for j in range(3):
              for k in range(5):
                  for l in range(7):
                      similarities_np[i, j, k] += (
                          embeddings1_np[i, j, l]
                          * embeddings2_np[i, k, l]
                      )
                  similarities_np[i, j, k] /= max(
                      norm1_np[i, j] * norm2_np[i, k], eps
                  )
      np.testing.assert_allclose(
          similarities_th.numpy(), similarities_np, atol=1e-5
      )
  
file_path: pytorch-meta/torchmeta/tests/utils/test_matching.py
imports: import pytest
  from flaky import flaky
  import numpy
  import torch
  from torchmeta.utils.matching import pairwise_cosine_similarity, matching_log_probas, matching_probas, matching_loss
label_desc: Use image node_id 2 for calling a global function with example usage: test_pairwise_similarity_zero() without return types