TensorFlow 2.0 Beta is available Learn more

tfmot.sparsity.keras.PolynomialDecay

Class PolynomialDecay

Pruning Schedule with a PolynomialDecay function.

Inherits From: PruningSchedule

Defined in python/core/sparsity/keras/pruning_schedule.py.

__init__

__init__(
    initial_sparsity,
    final_sparsity,
    begin_step,
    end_step,
    power=3,
    frequency=100
)

Initializes a Pruning schedule with a PolynomialDecay function.

Pruning rate grows rapidly in the beginning from initial_sparsity, but then plateaus slowly to the target sparsity. The function applied is

current_sparsity = final_sparsity + (initial_sparsity - final_sparsity) * (1 - (step - begin_step)/(end_step - begin_step)) ^ exponent

which is a polynomial decay function. See paper.

Args:

  • initial_sparsity: Sparsity (%) at which pruning begins.
  • final_sparsity: Sparsity (%) at which pruning ends.
  • begin_step: Step at which to begin pruning.
  • end_step: Step at which to end pruning.
  • power: Exponent to be used in the sparsity function.
  • frequency: Only apply pruning every frequency steps.

Methods

__call__

__call__(step)

from_config

from_config(
    cls,
    config
)

Instantiates a PruningSchedule from its config.

Args:

  • config: Output of get_config().

Returns:

A PruningSchedule instance.

get_config

get_config()