class_docstr: This class is testing the examples in https://coremltools.readme.io/v7.0/docs/data-free-quantization
code: def test_quantization(self):
      import coremltools.optimize.coreml as cto
  
      model = get_mlmodel()
      op_config = cto.OpLinearQuantizerConfig(
          mode="linear_symmetric", weight_threshold=512
      )
      config = cto.OptimizationConfig(global_config=op_config)
  
      compressed_8_bit_model = cto.linear_quantize_weights(
          model, config=config
      )
  
      # Some basic checks
      assert compressed_8_bit_model is not None
      ops = get_op_types_in_program(compressed_8_bit_model._mil_program)
      assert ops.count("constexpr_affine_dequantize") == 6
  
imports: import tempfile
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
  from coremltools.test.optimize.coreml.test_passes import TestCompressionPasses
  from coremltools.test.optimize.coreml.test_passes import TestConfigurationFromDictFromYaml
label_desc: Use image node_id 1 for calling the TestPostTrainingQuantization obj's underlying member method code with example usage: obj.test_quantization() without return types