code: def dot(X: np.ndarray, Y: np.ndarray) -> Union[float, np.ndarray]:
      """
      Performs a dot product between the vector(s) in X and vector Y. (:math:`X^T Y = \\sum_i X_i Y_i`). 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.
  
      Returns
      -------
          Matrix of dot products 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`."
      return np.dot(X, Y.T)
  
imports: from typing import Union
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: dot(X, Y) and returns: np