# tfl.utils.canonicalize_convexity

<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/utils.py#L25-L52) |

Converts string constants representing convexity into integers.

    tfl.utils.canonicalize_convexity(
        convexity
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `convexity` | The convexity hyperparameter of [`tfl.layers.PWLCalibration`](https://www.tensorflow.org/lattice/api_docs/python/tfl/layers/PWLCalibration) layer. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| convexity represented as -1, 0, 1, or None. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | If convexity is not in the set {-1, 0, 1, 'concave', 'none', 'convex'}. |

<br />