code: def test_weight_pruning_block_sparsity(self):
      (
          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_sparsified = prune_weights(
          mlmodel,
          mode="block_sparsity",
          target_sparsity=0.3,
          block_size=5,
      )
  
      # validate parameters
      expected_ops = [
          "constexpr_sparse_to_dense",
          "cast",
          "conv",
          "cast",
      ]
      assert (
          get_op_types_in_program(mlmodel_sparsified._mil_program)
          == expected_ops
      )
  
imports: import itertools
  import numpy
  import pytest
  import torch
  import coremltools
  import coremltools.optimize
  from coremltools._deps import _HAS_SKLEARN
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
  from coremltools.optimize.coreml._post_training_quantization import CoreMLWeightMetaData
  from coremltools.test.ml_program.test_compression import get_test_model_and_data
label_desc: Use image node_id 4 for calling the TestPruneWeights obj's underlying member method code with example usage: obj.test_weight_pruning_block_sparsity() without return types