TF 2.0 is out! Get hands-on practice at TF World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

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

add_pruning_summaries

View source

add_pruning_summaries()

Adds summaries of weight sparsities and thresholds.

conditional_mask_update_op

View source

conditional_mask_update_op()

mask_update_op

View source

mask_update_op()

View source

print_hparams()