tf.contrib.model_pruning.Pruning

Class Pruning

Defined in tensorflow/contrib/model_pruning/python/pruning.py.

__init__

__init__(
    spec=None,
    global_step=None,
    sparsity=None
)

Set up the specification for model pruning.

If a spec is provided, the sparsity is set up based on the sparsity_function in the spec. The effect of sparsity_function is overridden if the sparsity variable is passed to the constructor. This enables setting up arbitrary sparsity profiles externally and passing it to this pruning functions.

Args:

  • spec: Pruning spec as defined in pruning.proto
  • global_step: A tensorflow variable that is used while setting up the sparsity function
  • sparsity: A tensorflow scalar variable storing the sparsity

Methods

add_pruning_summaries

add_pruning_summaries()

Adds summaries of weight sparsities and thresholds.

conditional_mask_update_op

conditional_mask_update_op()

mask_update_op

mask_update_op()
print_hparams()