# tfl.pwl_calibration_lib.compute_interpolation_weights

<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#L95-L126) |

Computes weights for PWL calibration.

    tfl.pwl_calibration_lib.compute_interpolation_weights(
        inputs, keypoints, lengths
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `inputs` | Tensor of shape: `(batch_size, 1)`, `(batch_size, units, 1)` or `(batch_size, 1, 1)`. For multi-unit calibration, broadcasting will be used if needed. |
| `keypoints` | Tensor of shape `(num_keypoints-1)` or `(units, num_keypoints-1)` which represents left keypoint of pieces of piecewise linear function along X axis. |
| `lengths` | Tensor of shape `(num_keypoints-1)` or `(units, num_keypoints-1)` which represents lengths of pieces of piecewise linear function along X axis. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Interpolation weights tensor of shape: `(batch_size, num_keypoints)` or `(batch_size, units, num_keypoints)`. ||

<br />