class_docstr: Since ct.compression_utils is deprecated, this test is only checking the API is still working.
class_docstr_tok: ["Since","ct.compression_utils","is","deprecated",",","this","test","is","only","checking","the","API","is","still","working","."]
code: def test_op_selector():
      (
          model,
          inputs,
          torch_input_values,
          coreml_input_values,
      ) = get_test_model_and_data()
      torchmodel = torch.jit.trace(model, torch_input_values)
      mlmodel = ct.convert(
          torchmodel, inputs=inputs, convert_to="mlprogram"
      )
      mlmodel_no_quantized = affine_quantize_weights(
          mlmodel,
          mode="linear",
          op_selector=lambda const_op: const_op.val.val.size > 1e7,
      )
      expected_ops = ["cast", "conv", "cast"]
      assert (
          get_op_types_in_program(mlmodel_no_quantized._mil_program)
          == expected_ops
      )
  
file_path: coremltools/coremltools/test/ml_program/test_compression.py
imports: from typing import Optional
  import numpy
  import torch
  import coremltools
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
  from coremltools.models.ml_program.compression_utils import affine_quantize_weights, decompress_weights, palettize_weights, sparsify_weights
  from coremltools.optimize.coreml._config import OpCompressorConfig
label_desc: Use image node_id 1 for calling the TestCompressionUtils obj's underlying member method code with example usage: obj.test_op_selector() without return types