class_docstr: The abstract class for the compression graph passes.
class_docstr_tok: ["The","abstract","class","for","the","compression","graph","passes","."]
docstr: 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.
code: def need_compress_const(
      op: Operation, _is_deprecated: bool, weight_threshold: float
  ):
      """
      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 = op.outputs[0].val
      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)
  
      # const fed into constexpr ops cannot be compressed
      if any(
          [
              child_op.op_type.startswith("constexpr")
              for child_op in op.outputs[0].child_ops
          ]
      ):
          return False
  
      if weight_threshold is None:
          raise ValueError("weight_threshold cannot be None")
  
      return should_use_weight_file(val) and val.size > weight_threshold
  
imports: from typing import Callable, Optional, Tuple
  import numpy
  from tqdm import tqdm
  from coremltools import _logger
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.backend.mil.load import should_use_weight_file
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Operation, Program, types
  from coremltools.converters.mil.mil.block import is_current_opset_version_compatible_with
  from coremltools.converters.mil.mil.ops.defs._utils import pack_elements_into_bits
  from coremltools.converters.mil.mil.ops.defs.iOS16 import constexpr_affine_dequantize, constexpr_lut_to_dense, constexpr_sparse_to_dense
  from coremltools.converters.mil.mil.passes.defs.quantization import AbstractQuantizationPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
  from coremltools.converters.mil.mil.types.type_mapping import nptype_from_builtin
  from coremltools.models.neural_network.quantization_utils import _get_kmeans_lookup_table_and_weight
  from coremltools.optimize.coreml._config import OpLinearQuantizerConfig, OpMagnitudePrunerConfig, OpPalettizerConfig, OpThresholdPrunerConfig, OptimizationConfig
label_desc: Use image node_id 5 for calling the AbstractCompressionPass obj's underlying member method code with example usage: obj.need_compress_const(op, _is_deprecated, weight_threshold) and returns: unknown, should_use_weight_file, False