<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_schedule.py#L180-L259) |

Pruning Schedule with a PolynomialDecay function.

Inherits From: [`PruningSchedule`](https://www.tensorflow.org/model_optimization/api_docs/python/tfmot/sparsity/keras/PruningSchedule)

    tfmot.sparsity.keras.PolynomialDecay(
        initial_sparsity,
        final_sparsity,
        begin_step,
        end_step,
        power=3,
        frequency=100
    )

### Used in the notebooks

| Used in the guide |
|---|
| - [Pruning for on-device inference w/ XNNPACK](https://www.tensorflow.org/model_optimization/guide/pruning/pruning_for_on_device_inference) - [Pruning in Keras example](https://www.tensorflow.org/model_optimization/guide/pruning/pruning_with_keras) |

<br />

<br />

<br />

| ## 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. |

<br />

## Methods

### `from_config`

[View source](https://github.com/tensorflow/model-optimization/blob/v0.8.1/tensorflow_model_optimization/python/core/sparsity/keras/pruning_schedule.py#L121-L131)

    @classmethod
    from_config(
        config
    )

Instantiates a `PruningSchedule` from its config.

<br />

<br />

<br />

| Args ||
|---|---|
| `config` | Output of `get_config()`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A `PruningSchedule` instance. ||

<br />

### `get_config`

[View source](https://github.com/tensorflow/model-optimization/blob/v0.8.1/tensorflow_model_optimization/python/core/sparsity/keras/pruning_schedule.py#L248-L259)

    get_config()

### `__call__`

[View source](https://github.com/tensorflow/model-optimization/blob/v0.8.1/tensorflow_model_optimization/python/core/sparsity/keras/pruning_schedule.py#L222-L246)

    __call__(
        step
    )

Returns the sparsity(%) to be applied.

If the returned sparsity(%) is 0, pruning is ignored for the step.

<br />

<br />

<br />

| Args ||
|---|---|
| `step` | Current step in graph execution. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| Sparsity (%) that should be applied to the weights for the step. ||

<br />