code: def pairwise_cosine_similarity(embeddings1, embeddings2, eps=1e-8):
      r"""Computes the pairwise cosine similarity between two tensors of embeddings.
  
      Parameters
      ----------
      embeddings1 : `torch.Tensor` instance
          A tensor containing embeddings with shape
          `(batch_size, N, embedding_size)`.
  
      embeddings2 : `torch.Tensor` instance
          A tensor containing embeddings with shape
          `(batch_size, M, embedding_size)`.
  
      eps: float (default: 1e-8)
          Small value to avoid division by zero.
  
      Returns
      -------
      similarities : `torch.Tensor` instance
          A tensor containing the pairwise cosine similarities between the vectors
          in `embeddings1` and `embeddings2`. This tensor has shape
          `(batch_size, N, M)`.
  
      Notes
      -----
      The cosine similarity is computed as
  
          .. math ::
              \text{similarity} = \dfrac{x_1 \cdot x_2}{\max(\Vert x_1 \Vert _2 \cdot \Vert x_2 \Vert _2, \epsilon)}
      """
      sq_norm1 = torch.sum(embeddings1**2, dim=2, keepdim=True)
      sq_norm2 = torch.sum(embeddings2**2, dim=2).unsqueeze(1)
      dot_product = torch.bmm(embeddings1, embeddings2.transpose(1, 2))
      inverse_norm = torch.rsqrt(
          torch.clamp(sq_norm1 * sq_norm2, min=eps**2)
      )
      return dot_product * inverse_norm
  
imports: import torch
  import torch.nn.functional
label_desc: Use image node_id 1 for calling a global function with example usage: pairwise_cosine_similarity(embeddings1, embeddings2, eps) and returns: unknown