code: def _euclidean_distances(
      X, Y, X_norm_squared=None, Y_norm_squared=None, squared=False
  ):
      """Computational part of euclidean_distances
  
      Assumes inputs are already checked.
  
      If norms are passed as float32, they are unused. If arrays are passed as
      float32, norms needs to be recomputed on upcast chunks.
      TODO: use a float64 accumulator in row_norms to avoid the latter.
      """
      if X_norm_squared is not None:
          if X_norm_squared.dtype == np.float32:
              XX = None
          else:
              XX = X_norm_squared.reshape(-1, 1)
      elif X.dtype == np.float32:
          XX = None
      else:
          XX = row_norms(X, squared=True)[:, np.newaxis]
  
      if Y is X:
          YY = None if XX is None else XX.T
      else:
          if Y_norm_squared is not None:
              if Y_norm_squared.dtype == np.float32:
                  YY = None
              else:
                  YY = Y_norm_squared.reshape(1, -1)
          elif Y.dtype == np.float32:
              YY = None
          else:
              YY = row_norms(Y, squared=True)[np.newaxis, :]
  
      if X.dtype == np.float32:
          # To minimize precision issues with float32, we compute the distance
          # matrix on chunks of X and Y upcast to float64
          distances = _euclidean_distances_upcast(X, XX, Y, YY)
      else:
          # if dtype is already float64, no need to chunk and upcast
          distances = -2 * safe_sparse_dot(X, Y.T, dense_output=True)
          distances += XX
          distances += YY
      np.maximum(distances, 0, out=distances)
  
      # Ensure that distances between vectors and themselves are set to 0.0.
      # This may not be the case due to floating point rounding errors.
      if X is Y:
          np.fill_diagonal(distances, 0)
  
      return distances if squared else np.sqrt(distances, out=distances)
  
imports: import itertools
  import warnings
  from functools import partial
  import numpy
  from joblib import effective_n_jobs
  from scipy.sparse import csr_matrix, issparse
  from scipy.spatial import distance
  from ..None import config_context
  from ..exceptions import DataConversionWarning
  from ..preprocessing import normalize
  from ..utils import check_array, gen_batches, gen_even_slices, get_chunk_n_rows, is_scalar_nan
  from ..utils._mask import _get_mask
  from ..utils._param_validation import Hidden, Integral, Interval, MissingValues, Options, Real, StrOptions, validate_params
  from ..utils.extmath import row_norms, safe_sparse_dot
  from ..utils.fixes import parse_version, sp_base_version
  from ..utils.parallel import Parallel, delayed
  from ..utils.validation import _num_samples, check_non_negative
  from ._pairwise_distances_reduction import ArgKmin
  from ._pairwise_fast import _chi2_kernel_fast, _sparse_manhattan
label_desc: Use image node_id 5 for calling a global function with example usage: _euclidean_distances(X, Y, X_norm_squared, Y_norm_squared, squared) and returns: unknown