def need_compress_const(
        self, op: Operation, _is_deprecated: bool, weight_threshold: float
    ) -> bool:
        """
        The utility function is checking whether a const op can be compressed.
        If ``_is_deprecated = True``, the user is using the ``ct.compression_utils``, in which the ops are already filtered by ``op_selector``.
        For the new ``ct.optimize.coreml`` API, ``op_selector`` is no longer supported, so the ``weight_threshold`` is checked explicitly instead.
        """
        val = self._get_const_value(op)
        if _is_deprecated and weight_threshold != None:
            raise ValueError("weight_threshold cannot be set through the deprecated ct.compression_util API")

        if _is_deprecated:
            return should_use_weight_file(val)

        if not self._validate_child_constexpr_for_compress(op):
            return False

        if weight_threshold is None:
            raise ValueError("weight_threshold cannot be None")

        # Disable 1D tensor compression due to MIL 1D Tensor bug (rdar://113860800).
        if (
            not op.outputs[0].child_ops[0].op_type.startswith("constexpr_")
            and op.outputs[0].rank <= 1
        ):
            return False

        return (
            should_use_weight_file(val) and self._get_weight_to_compress_size(op) > weight_threshold
        )

        The utility function is checking whether a const op can be compressed.
        If ``_is_deprecated = True``, the user is using the ``ct.compression_utils``, in which the ops are already filtered by ``op_selector``.
        For the new ``ct.optimize.coreml`` API, ``op_selector`` is no longer supported, so the ``weight_threshold`` is checked explicitly instead.
        
coremltools/optimize/coreml/_quantization_passes.py