# tf_agents.utils.common.scale_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#L575-L592) |

Shapes and scales a batch into the given spec bounds.

    tf_agents.utils.common.scale_to_spec(
        tensor, spec
    )

### Used in the notebooks

| Used in the tutorials |
|---|
| - [Networks](https://www.tensorflow.org/agents/tutorials/8_networks_tutorial) |

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor` | A \[batch x n\] tensor with values in the range of \[-1, 1\]. |
| `spec` | (BoundedTensorSpec) to use for scaling the action. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A batch scaled the given spec bounds. ||

<br />