class_docstr: Internal class that manages partitioning. The ``FakePalettize`` class base classes the ``_Partitioner`` class
  and all the partitioning logic is controlled by this class.
docstr: Method to get kmeans for a particular partition.
code: def get_partition_kmeans(
      self,
      weights: _torch.Tensor,
      partition_index: int,
      partition: int,
      max_iter: int,
      init: str,
  ):
      """
      Method to get kmeans for a particular partition.
      """
      Y = weights[partition[0] : partition[1]].detach()
      cY, pad = self.flatten(Y)
  
      kmeans = _EfficientKMeans(
          n_clusters=self.n_clusters[partition_index],
          init=init,
          labels=self.labels_init[partition_index],
          n_init=10,
          max_iter=max_iter,
      ).fit(cY)
  
      if self.enforce_zero[partition_index]:
          zero_point = (
              _torch.zeros(kmeans.cluster_centers_[0].size())
              .to(kmeans.cluster_centers_.device)
              .unsqueeze(0)
          )
          zero_idx = _torch.argmin(
              _torch.cdist(kmeans.cluster_centers_, zero_point)
          )
          kmeans.cluster_centers_[zero_idx] = zero_point
  
      weights[partition[0] : partition[1]] = self.deflatten(
          kmeans.cluster_centers_[kmeans.labels_], Y.size(), pad
      )
  
      return kmeans
  
file_path: coremltools/coremltools/optimize/torch/palettization/_partitioner.py
imports: from typing import Tuple
  import torch
  from ._efficient_kmeans import _EfficientKMeans
label_desc: Use image node_id 3 for calling the _Partitioner obj's underlying member method code with example usage: obj.get_partition_kmeans(weights, partition_index, partition, max_iter, init) and returns: kmeans