class_docstr: This class is testing examples in https://coremltools.readme.io/v7.0/docs/pruning-a-core-ml-model
code: def test_magnitute_pruner(self):
      from coremltools.optimize.coreml import (
          OpMagnitudePrunerConfig,
          OptimizationConfig,
          prune_weights,
      )
  
      model = get_mlmodel()
      op_config = OpMagnitudePrunerConfig(
          target_sparsity=0.6,
          weight_threshold=1024,
      )
      config = OptimizationConfig(global_config=op_config)
      model_compressed = prune_weights(model, config=config)
  
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 2 for calling the TestPostTrainingPruning obj's underlying member method code with example usage: obj.test_magnitute_pruner() without return types