class_docstr: _EfficientKMeans is primarily used by palettization to perform a k-means operation. This class also has an in-house
  implementation of k-means, called ``kmeans_pp`` which runs entirely on GPU and is ~10x faster than sklearn's API.
docstr: Method to calculate distance between weights and centroids.
docstr_tok: ["Method","to","calculate","distance","between","weights","and","centroids","."]
code: def x_c_dist(weights: _torch.Tensor, centroids: _torch.Tensor):
      """
      Method to calculate distance between weights and centroids.
      """
      return _torch.cdist(weights, centroids).square()
  
file_path: coremltools/coremltools/optimize/torch/palettization/_efficient_kmeans.py
imports: import numpy
  import torch
  import torch.distributed
label_desc: Use image node_id 2 for calling the _EfficientKMeans obj's underlying member method code with example usage: obj.x_c_dist(weights, centroids) and returns: _torch