# tf_agents.utils.composite.expand_dims

<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/composite.py#L94-L127) |

Add a new dimension to tensor `t` along `axis`.

    tf_agents.utils.composite.expand_dims(
        t, axis
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `t` | A [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or [`tf.SparseTensor`](https://www.tensorflow.org/api_docs/python/tf/sparse/SparseTensor). |
| `axis` | A `0D` integer scalar. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| An expanded tensor. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `NotImplementedError` | If `t` is a `SparseTensor` and `axis != 0`. |

<br />