def _construct_compression_op(self, val: np.ndarray, param_name: str) -> Var:
        """Construct the compression op based on the compression info."""
        compression_info: CompressionInfo = self.param_to_compression_info[param_name]

        shared_msg = (
            "There are coreml compression related buffers registered in the torch "
            f"model (with {_COMPRESSION_INFO_PREFIX} in the buffer's name) for {param_name}"
        )
        if not compression_info.compression_type:
            raise ValueError(
                shared_msg + ", but the 'compression_type' is not set. Please set it to indicate "
                "the type of compression used on the weight."
            )
        if len(compression_info.compression_type) > 3:
            raise ValueError(
                shared_msg + ", but the 'compression_type' has too many values. Support at most 3 "
                "values."
            )

        if len(compression_info.compression_type) > 1:
            if not is_current_opset_version_compatible_with(_target.iOS18):
                raise ValueError(
                    "The joint compression (more than one values in 'compression_type') is only "
                    "supported in iOS18+. Please set minimum_deployment_target to iOS18 or later."
                )

        result: Optional[Var] = None
        for type_val in compression_info.compression_type:
            if type_val == CompressionType.QUANTIZATION.value:
                result = self._construct_quantization_op(val, compression_info, param_name, result)
            elif type_val == CompressionType.PALETTIZATION.value:
                result = self._construct_palettization_op(val, compression_info, param_name, result)
            else:
                assert type_val == CompressionType.PRUNING.value
                result = self._construct_sparsification_op(
                    val, compression_info, param_name, result
                )

        if result is None:
            raise AssertionError(shared_msg + f", but unable to compress weight {param_name}")
        return result
Construct the compression op based on the compression info.
coremltools/converters/mil/frontend/torch/converter.py