<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/model-optimization/blob/v0.8.1/tensorflow_model_optimization/python/core/sparsity/keras/pruning_callbacks.py#L36-L79) |

Keras callback which updates pruning wrappers with the optimizer step.

    tfmot.sparsity.keras.UpdatePruningStep()

### Used in the notebooks

| Used in the guide |
|---|
| - [Pruning comprehensive guide](https://www.tensorflow.org/model_optimization/guide/pruning/comprehensive_guide) - [Sparsity and cluster preserving quantization aware training (PCQAT) Keras example](https://www.tensorflow.org/model_optimization/guide/combine/pcqat_example) - [Pruning preserving quantization aware training (PQAT) Keras example](https://www.tensorflow.org/model_optimization/guide/combine/pqat_example) - [Sparsity preserving clustering Keras example](https://www.tensorflow.org/model_optimization/guide/combine/sparse_clustering_example) - [Pruning for on-device inference w/ XNNPACK](https://www.tensorflow.org/model_optimization/guide/pruning/pruning_for_on_device_inference) |

This callback must be used when training a model which needs to be pruned. Not
doing so will throw an error.

#### Example:

    model.fit(x, y,
        callbacks=[UpdatePruningStep()])

## Methods

### `set_model`

    set_model(
        model
    )

### `set_params`

    set_params(
        params
    )