# tf.keras.optimizers.schedules.PiecewiseConstantDecay

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/schedules/PiecewiseConstantDecay) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/optimizer_v2/learning_rate_schedule.py#L168-L263) |

A LearningRateSchedule that uses a piecewise constant decay schedule.

Inherits From: [`LearningRateSchedule`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/keras/optimizers/schedules/LearningRateSchedule)

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.keras.optimizers.schedules.PiecewiseConstantDecay`](https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/schedules/PiecewiseConstantDecay), \`tf.compat.v2.keras.optimizers.schedules.PiecewiseConstantDecay\`, \`tf.compat.v2.optimizers.schedules.PiecewiseConstantDecay\`

<br />

    tf.keras.optimizers.schedules.PiecewiseConstantDecay(
        boundaries, values, name=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `boundaries` | A list of `Tensor`s or `int`s or `float`s with strictly increasing entries, and with all elements having the same type as the optimizer step. |
| `values` | A list of `Tensor`s or `float`s or `int`s that specifies the values for the intervals defined by `boundaries`. It should have one more element than `boundaries`, and all elements should have the same type. |
| `name` | A string. Optional name of the operation. Defaults to 'PiecewiseConstant'. |

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | if the number of elements in the lists do not match. |

<br />

## Methods

### `from_config`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/optimizer_v2/learning_rate_schedule.py#L50-L60)

    @classmethod
    from_config(
        config
    )

Instantiates a `LearningRateSchedule` from its config.

<br />

<br />

<br />

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

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A `LearningRateSchedule` instance. ||

<br />

### `get_config`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/optimizer_v2/learning_rate_schedule.py#L258-L263)

    get_config()

### `__call__`

[View source](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/keras/optimizer_v2/learning_rate_schedule.py#L235-L256)

    __call__(
        step
    )

Call self as a function.