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 initialize the partitions and set the k-means. Called during first iteration of palettization in the
  forward method of ``FakePalettize``.
code: def init_partitions(self, weights: _torch.Tensor):
      """
      Method to initialize the partitions and set the k-means. Called during first iteration of palettization in the
      forward method of ``FakePalettize``.
      """
      with _torch.no_grad():
          self.create_partitions(weights)
          for i, partition in enumerate(self.partitions):
              kmeans = self.get_partition_kmeans(
                  weights.clone(),
                  i,
                  partition,
                  max_iter=100,
                  init=self.centroids_init[i],
              )
  
              self.centroids_init[i] = kmeans.cluster_centers_
              self.labels_init[i] = kmeans.labels_
              self.n_clusters[i] = kmeans.n_clusters
  
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 4 for calling the _Partitioner obj's underlying member method code with example usage: obj.init_partitions(weights) without return types