code: def _labels_inertia(
      X,
      sample_weight,
      x_squared_norms,
      centers,
      session=None,
      run_kwargs=None,
  ):
      """E step of the K-means EM algorithm.
  
      Compute the labels and the inertia of the given samples and centers.
  
      Parameters
      ----------
      X : {array-like, sparse matrix} of shape (n_samples, n_features)
          The input samples to assign to the labels. If sparse matrix, must be in
          CSR format.
  
      sample_weight : array-like of shape (n_samples,)
          The weights for each observation in X.
  
      x_squared_norms : Tensor of shape (n_samples,)
          Precomputed squared euclidean norm of each data point, to speed up
          computations.
  
      centers : Tensor, shape (n_clusters, n_features)
          The cluster centers.
  
      Returns
      -------
      labels : ndarray of shape (n_samples,)
          The resulting assignment
  
      inertia : float
          Sum of squared distances of samples to their closest cluster center.
      """
      n_samples = X.shape[0]
      n_clusters = centers.shape[0]
  
      sample_weight = _check_normalize_sample_weight(sample_weight, X)
      labels = mt.full(n_samples, -1, dtype=np.int32)
      weight_in_clusters = mt.zeros(n_clusters, dtype=centers.dtype)
      center_shift = mt.zeros_like(weight_in_clusters)
  
      centers, weight_in_clusters, labels, center_shift = lloyd_iter(
          X,
          sample_weight,
          x_squared_norms,
          centers,
          labels,
          center_shift,
          update_centers=False,
          session=session,
          run_kwargs=run_kwargs,
      )
  
      inertia = _inertia(X, sample_weight, centers, labels)
  
      return labels, inertia
  
imports: import warnings
  import numpy
  from sklearn.base import ClusterMixin, TransformerMixin
  from sklearn.exceptions import ConvergenceWarning
  from ...None import tensor
  from ...tensor.utils import check_random_state
  from ..base import BaseEstimator
  from ..metrics.pairwise import euclidean_distances
  from ..utils.extmath import row_norms
  from ..utils.validation import _check_sample_weight, check_array, _num_samples, check_is_fitted
  from ._k_means_common import _inertia
  from ._k_means_elkan_iter import init_bounds, elkan_iter
  from ._k_means_init import _k_init, _scalable_k_init
  from ._k_means_lloyd_iter import lloyd_iter
label_desc: Use image node_id 7 for calling a global function with example usage: _labels_inertia(X, sample_weight, x_squared_norms, centers, session, run_kwargs) and returns: labels,  inertia