code: def prune_for_benchmark(
      keras_model, target_sparsity, block_size=(1, 1)
  ):
      """Prunes a tf.keras model in a single step, without re-training.
  
      This function is intented to quickly apply sparsity to a model, without
      consideration for accuracy.
  
      Args:
        keras_model: A `tf.keras.Model` instance.
        target_sparsity: Target sparsity as float, in [0, 1] interval.
        block_size: The dimensions (height, weight) for the block sparse
          pattern in rank-2 weight tensors.
      Returns:
        A pruned model, modified with pruning wrappers.
      """
  
      pruning_params = {
          "pruning_schedule": StepIndependentConstantSparsity(
              target_sparsity
          ),
          "block_size": block_size,
      }
  
      prunable_object = prune.prune_low_magnitude(
          keras_model, **pruning_params
      )
      _apply_pruning(prunable_object)
  
      return prunable_object
  
file_path: model-optimization/tensorflow_model_optimization/python/core/sparsity/keras/tools/sparsity_tooling.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from tensorflow_model_optimization.python.core.keras import metrics
  from tensorflow_model_optimization.python.core.sparsity.keras import prune
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_schedule
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_wrapper
label_desc: Use image node_id 2 for calling a global function with example usage: prune_for_benchmark(keras_model, target_sparsity, block_size) and returns: prunable_object