def sanitize_palettization_group_size(self):
        """
        Validates and updates block_size attribute in palettization config for specified parameter.
        If compression should be skipped for param, returns False.
        Else, returns True and updates config inplace.
        """
        if self.config.granularity != _PalettizationGranularity.per_grouped_channel:
            return True

        # If block size is not divisible by axis length skip palettizing this param
        if (
            self.module_level_advanced_options
            and self.module_level_advanced_options["cluster_permute"]
        ):
            axis_length = self.param.permute(
                self.module_level_advanced_options["cluster_permute"]
            ).shape[self.config.channel_axis]
        else:
            axis_length = self.param.shape[self.config.channel_axis]
        if axis_length % self.config.group_size != 0:
            _logger.warning(
                f"{self.param_name}: axis_length={axis_length} is not divisible by group_size={self.config.group_size}"
            )
            return False

        return True

        Validates and updates block_size attribute in palettization config for specified parameter.
        If compression should be skipped for param, returns False.
        Else, returns True and updates config inplace.
        
coremltools/optimize/torch/_utils/validation_utils.py