code: def cos(
      X: np.ndarray, Y: np.ndarray, eps: float = 1e-7
  ) -> Union[float, np.ndarray]:
      """
      Computes the cosine between the vector(s) in X and vector Y. (:math:`X^T Y/\\|X\\|\\|Y\\|`). Each of `X` and `Y`
      should have a leading batch dimension of size at least 1.
  
      Parameters
      ----------
      X
          Matrix of vectors.
      Y
          Matrix of vectors.
      eps
          Numerical stability.
  
      Returns
      -------
          Matrix of cosine similarities between the vector(s) in X and vectors in Y.
      """
      assert (
          len(X.shape) > 1 and len(Y.shape) > 1
      ), "The vectors `X` and `Y` should have a leading batch dimension."
      assert (
          X.shape[1] == Y.shape[1]
      ), "The second dimension of `X` needs to be the same as the dimension of `Y`."
      denominator = (
          np.linalg.norm(X, axis=1)[:, None]
          @ np.linalg.norm(Y, axis=1)[None, :]
      )
      return np.dot(X, Y.T) / (denominator + eps)
  
imports: from typing import Union
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: cos(X, Y, eps) and returns: unknown