Pruning Schedule with a PolynomialDecay function.
Inherits From: PruningSchedule
tfmot.sparsity.keras.PolynomialDecay(
initial_sparsity,
final_sparsity,
begin_step,
end_step,
power=3,
frequency=100
)
Used in the notebooks
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
from_config
View source
@classmethod
from_config(
config
)
Instantiates a PruningSchedule
from its config.
Args |
config
|
Output of get_config() .
|
Returns |
A PruningSchedule instance.
|
get_config
View source
get_config()
__call__
View source
__call__(
step
)
Returns the sparsity(%) to be applied.
If the returned sparsity(%) is 0, pruning is ignored for the step.
Args |
step
|
Current step in graph execution.
|
Returns |
Sparsity (%) that should be applied to the weights for the step.
|