code: def euclidean_distances(
      X, Y=None, Y_norm_squared=None, squared=False, X_norm_squared=None
  ):
      """
      Considering the rows of X (and Y=X) as vectors, compute the
      distance matrix between each pair of vectors.
  
      For efficiency reasons, the euclidean distance between a pair of row
      vector x and y is computed as::
  
          dist(x, y) = sqrt(dot(x, x) - 2 * dot(x, y) + dot(y, y))
  
      This formulation has two advantages over other ways of computing distances.
      First, it is computationally efficient when dealing with sparse data.
      Second, if one argument varies but the other remains unchanged, then
      `dot(x, x)` and/or `dot(y, y)` can be pre-computed.
  
      However, this is not the most precise way of doing this computation, and
      the distance matrix returned by this function may not be exactly
      symmetric as required by, e.g., ``scipy.spatial.distance`` functions.
  
      Read more in the :ref:`User Guide <metrics>`.
  
      Parameters
      ----------
      X : {array-like, sparse matrix}, shape (n_samples_1, n_features)
  
      Y : {array-like, sparse matrix}, shape (n_samples_2, n_features)
  
      Y_norm_squared : array-like, shape (n_samples_2, ), optional
          Pre-computed dot-products of vectors in Y (e.g.,
          ``(Y**2).sum(axis=1)``)
          May be ignored in some cases, see the note below.
  
      squared : boolean, optional
          Return squared Euclidean distances.
  
      X_norm_squared : array-like, shape = [n_samples_1], optional
          Pre-computed dot-products of vectors in X (e.g.,
          ``(X**2).sum(axis=1)``)
          May be ignored in some cases, see the note below.
  
      Notes
      -----
      To achieve better accuracy, `X_norm_squared` and `Y_norm_squared` may be
      unused if they are passed as ``float32``.
  
      Returns
      -------
      distances : tensor, shape (n_samples_1, n_samples_2)
  
      Examples
      --------
      >>> from mars.learn.metrics.pairwise import euclidean_distances
      >>> X = [[0, 1], [1, 1]]
      >>> # distance between rows of X
      >>> euclidean_distances(X, X).execute()
      array([[0., 1.],
             [1., 0.]])
      >>> # get distance to origin
      >>> euclidean_distances(X, [[0, 0]]).execute()
      array([[1.        ],
             [1.41421356]])
  
      See also
      --------
      paired_distances : distances betweens pairs of elements of X and Y.
      """
      if X.dtype == np.float32:
          if Y is None:
              dtype = X.dtype
          elif Y.dtype == np.float32:
              dtype = np.float32
          else:
              dtype = np.float64
      else:
          dtype = np.float64
  
      X, Y = EuclideanDistances.check_pairwise_arrays(X, Y)
      op = EuclideanDistances(
          x=X,
          y=Y,
          x_norm_squared=X_norm_squared,
          y_norm_squared=Y_norm_squared,
          squared=squared,
          dtype=np.dtype(dtype),
          chunk_store_limit=options.chunk_store_limit,
      )
      return op(
          X,
          Y=Y,
          Y_norm_squared=Y_norm_squared,
          X_norm_squared=X_norm_squared,
      )
  
imports: import numpy
  from ....None import opcodes
  from ....None import tensor
  from ....config import options
  from ....core import recursive_tile
  from ....serialization.serializables import KeyField, BoolField
  from ....tensor.core import TensorOrder
  from ....utils import has_unknown_shape
  from ...utils import check_array
  from ...utils.extmath import row_norms
  from .core import PairwiseDistances
label_desc: Use image node_id 1 for calling a global function with example usage: euclidean_distances(X, Y, Y_norm_squared, squared, X_norm_squared) and returns: op