# tf_agents.utils.common.clip_to_spec

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/common.py#L549-L559) |

Clips value to a given bounded tensor spec.

    tf_agents.utils.common.clip_to_spec(
        value, spec
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `value` | (tensor) value to be clipped. |
| `spec` | (BoundedTensorSpec) spec containing min. and max. values for clipping. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `clipped_value` | (tensor) `value` clipped to be compatible with `spec`. |

<br />