tfmot.sparsity.keras.PruneForLatencyOnXNNPack

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

Inherits From: PruningPolicy

Used in the notebooks

Used in the guide

PruneForLatencyOnXNNPack checks that the model contains a subgraph that can leverage XNNPACK's sparse inference and applies pruning wrapper only to Conv2D with kernel_size = (1, 1).

Reference:

Methods

allow_pruning

View source

Allows to prune only 1x1 Conv2D layers.

ensure_model_supports_pruning

View source

Ensures that the model contains only supported layers.