# tf_agents.utils.common.replicate

<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#L1104-L1148) |

Replicates a tensor so as to match the given outer shape.

    tf_agents.utils.common.replicate(
        tensor, outer_shape
    )

#### Example:

- t = [\[1, 2, 3\], \[4, 5, 6\]](https://www.tensorflow.org/agents/api_docs/python/tf_agents/utils/common/shape%20=%20%5B2,%203%5D)
- outer_shape = \[2, 1\] The shape of the resulting tensor is: \[2, 1, 2, 3\] and its content is: \[\[t\], \[t\]\]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor` | A tf.Tensor. |
| `outer_shape` | Outer shape given as a 1D tensor of type list, numpy or tf.Tensor. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The replicated tensor. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `ValueError` | when the outer shape is incorrect. |

<br />