tf.contrib.model_pruning.Pruning

View source on GitHub

Class Pruning

__init__

View source

__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

tf.contrib.model_pruning.Pruning.add_pruning_summaries

View source

add_pruning_summaries()

Adds summaries of weight sparsities and thresholds.

tf.contrib.model_pruning.Pruning.conditional_mask_update_op

View source

conditional_mask_update_op()

tf.contrib.model_pruning.Pruning.mask_update_op

View source

mask_update_op()

View source

print_hparams()