Module: tfmot.sparsity.keras

Module containing sparsity code built on Keras abstractions.

Classes

class ConstantSparsity: Pruning schedule with constant sparsity(%) throughout training.

class PolynomialDecay: Pruning Schedule with a PolynomialDecay function.

class PrunableLayer: Abstract Base Class for making your own keras layer prunable.

class PruneForLatencyOnXNNPack: Specifies to prune only 1x1 Conv2D layers in the model.

class PruningPolicy: Specifies what layers to prune in the model.

class PruningSchedule: Specifies when to prune layer and the sparsity(%) at each training step.

class PruningSummaries: A Keras callback for adding pruning summaries to tensorboard.

class UpdatePruningStep: Keras callback which updates pruning wrappers with the optimizer step.

Functions

prune_low_magnitude(...): Modify a tf.keras layer or model to be pruned during training.

prune_scope(...): Provides a scope in which Pruned layers and models can be deserialized.

strip_pruning(...): Strip pruning wrappers from the model.