code: def print_model_sparsity(pruned_model):
      """Prints sparsity for the pruned layers in the model.
  
      Model Sparsity Summary
      --
      prune_lstm_1: (kernel, 0.5), (recurrent_kernel, 0.6)
      prune_dense_1: (kernel, 0.5)
  
      Args:
        pruned_model: keras model to summarize.
  
      Returns:
        None
      """
  
      def _get_sparsity(weights):
          return 1.0 - np.count_nonzero(weights) / float(weights.size)
  
      print("Model Sparsity Summary ({})".format(pruned_model.name))
      print("--")
      for layer in pruned_model.layers:
          if isinstance(layer, pruning_wrapper.PruneLowMagnitude):
              prunable_weights = layer.layer.get_prunable_weights()
              if prunable_weights:
                  print(
                      "{}: {}".format(
                          layer.name,
                          ", ".join(
                              [
                                  "({}, {})".format(
                                      weight.name,
                                      str(
                                          _get_sparsity(
                                              K.get_value(weight)
                                          )
                                      ),
                                  )
                                  for weight in prunable_weights
                              ]
                          ),
                      )
                  )
      print("\n")
  
imports: import numpy
  import tensorflow
  from tensorflow_model_optimization.python.core.sparsity.keras import prune
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_callbacks
  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 1 for calling a global function with example usage: print_model_sparsity(pruned_model) and returns: unknown