def _move_centroids_and_labels_to_device(
        self, device: _torch.device, dtype: _torch.dtype
    ) -> None:
        """
        If centroids are loaded from a checkpoint, we may need to move them to the same device as the weights.
        """
        for cidx in range(len(self.centroids)):
            if isinstance(self.centroids[cidx], _torch.Tensor):
                self.centroids[cidx] = self.centroids[cidx].to(device).to(dtype)
            if isinstance(self.labels[cidx], _torch.Tensor):
                self.labels[cidx] = self.labels[cidx].to(device).to(dtype)

        If centroids are loaded from a checkpoint, we may need to move them to the same device as the weights.
        
coremltools/optimize/torch/palettization/_partitioner.py