# tfl.pwl_calibration_lib.linear_initializer

<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_lib.py#L129-L193) |

Initializes PWL calibration layer to represent linear function.

    tfl.pwl_calibration_lib.linear_initializer(
        shape, output_min, output_max, monotonicity, keypoints=None, dtype=None
    )

PWL calibration layer weights have shape `(num_keypoints, units)`. First row
represents bias. All remaining represent delta in y-value compare to previous
point. Aka heights of segments.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `shape` | Requested shape. Must be `(num_keypoints, units)`. |
| `output_min` | Minimum value of PWL calibration output after initialization. |
| `output_max` | Maximum value of PWL calibration output after initialization. |
| `monotonicity` | If one of {0, 1}, the returned function will go from `(input_min, output_min)` to `(input_max, output_max)`. If set to -1, the returned function will go from `(input_min, output_max)` to `(input_max, output_min)`. |
| `keypoints` | If not provided (None or \[\]), all pieces of returned function will have equal heights (i.e. `y[i+1] - y[i]` is constant). If provided, all pieces of returned function will have equal slopes (i.e. `(y[i+1] - y[i]) / (x[i+1] - x[i])` is constant). |
| `dtype` | dtype. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| PWLCalibration layer weights initialized according to params. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If given parameters are inconsistent. |

<br />