# tfl.pwl_calibration_layer.PWLCalibrationConstraints

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/pwl_calibration_layer.py#L688-L776) |

Monotonicity and bounds constraints for PWL calibration layer.

    tfl.pwl_calibration_layer.PWLCalibrationConstraints(
        monotonicity='none',
        convexity='none',
        lengths=None,
        output_min=None,
        output_max=None,
        output_min_constraints=https://www.tensorflow.org/lattice/api_docs/python/tfl/pwl_calibration_lib/BoundConstraintsType#NONE,
        output_max_constraints=https://www.tensorflow.org/lattice/api_docs/python/tfl/pwl_calibration_lib/BoundConstraintsType#NONE,
        num_projection_iterations=8
    )

Applies an approximate L2 projection to the weights of a PWLCalibration layer
such that the result satisfies the specified constraints.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `monotonicity` | Same meaning as corresponding parameter of `PWLCalibration`. |
| `convexity` | Same meaning as corresponding parameter of `PWLCalibration`. |
| `lengths` | Lengths of pieces of piecewise linear function. Needed only if convexity is specified. |
| `output_min` | Minimum possible output of pwl function. |
| `output_max` | Maximum possible output of pwl function. |
| `output_min_constraints` | A [`tfl.pwl_calibration_lib.BoundConstraintsType`](https://www.tensorflow.org/lattice/api_docs/python/tfl/pwl_calibration_lib/BoundConstraintsType) describing the constraints on the layer's minimum value. |
| `output_max_constraints` | A [`tfl.pwl_calibration_lib.BoundConstraintsType`](https://www.tensorflow.org/lattice/api_docs/python/tfl/pwl_calibration_lib/BoundConstraintsType) describing the constraints on the layer's maximum value. |
| `num_projection_iterations` | Same meaning as corresponding parameter of `PWLCalibration`. |

<br />

## Methods

### `from_config`

    @classmethod
    from_config(
        config
    )

Instantiates a weight constraint from a configuration dictionary.

#### Example:

    constraint = UnitNorm()
    config = constraint.get_config()
    constraint = UnitNorm.from_config(config)

<br />

<br />

<br />

| Args ||
|---|---|
| `config` | A Python dictionary, the output of `get_config`. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A [`tf.keras.constraints.Constraint`](https://www.tensorflow.org/api_docs/python/tf/keras/constraints/Constraint) instance. ||

<br />

### `get_config`

[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/pwl_calibration_layer.py#L765-L776)

    get_config()

Standard Keras config for serialization.

### `__call__`

[View source](https://github.com/tensorflow/lattice/blob/v2.1.1/tensorflow_lattice/python/pwl_calibration_layer.py#L752-L763)

    __call__(
        w
    )

Applies constraints to w.