class_docstr: Implementation of magnitude-based weight pruning.
class_docstr_tok: ["Implementation","of","magnitude-based","weight","pruning","."]
docstr: Adds summaries of weight sparsities and thresholds.
docstr_tok: ["Adds","summaries","of","weight","sparsities","and","thresholds","."]
code: def add_pruning_summaries(self):
      """Adds summaries of weight sparsities and thresholds."""
      # TODO(b/139939526): update to use public API.
      summary = tf.summary
      if not tf.executing_eagerly():
          summary = tf.compat.v1.summary
      summary.scalar(
          "sparsity", self._pruning_schedule(self._step_fn())[1]
      )
      for _, mask, threshold in self._pruning_vars:
          summary.scalar(
              mask.name + "/sparsity", 1.0 - tf.math.reduce_mean(mask)
          )
          summary.scalar(threshold.name + "/threshold", threshold)
  
file_path: model-optimization/tensorflow_model_optimization/python/core/sparsity/keras/pruning_impl.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 compat
  from tensorflow_model_optimization.python.core.sparsity.keras import pruning_utils
label_desc: Use image node_id 9 for calling the Pruning obj's underlying member method code with example usage: obj.add_pruning_summaries() without return types