<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/keras-team/keras/tree/v3.15.1/keras/src/ops/numpy.py#L3008-L3040) |

Stack tensors in sequence depth wise (along third axis).

#### View aliases


**Main aliases**

[`tf.keras.ops.numpy.dstack`](https://www.tensorflow.org/api_docs/python/tf/keras/ops/dstack)

<br />

    tf.keras.ops.dstack(
        xs
    )

This is equivalent to concatenation along the third axis after 2-D tensors
of shape `(M, N)` have been reshaped to `(M, N, 1)` and 1-D tensors of shape
`(N,)` have been reshaped to `(1, N, 1)`.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `xs` | Sequence of tensors. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| The tensor formed by stacking the given tensors. ||

<br />

#### Examples:

    import keras
    x = keras.ops.array([1, 2, 3])
    y = keras.ops.array([4, 5, 6])
    keras.ops.dstack([x, y])
    array([[[1, 4],
            [2, 5],
            [3, 6]]])

    x = keras.ops.array([[1], [2], [3]])
    y = keras.ops.array([[4], [5], [6]])
    keras.ops.dstack([x, y])
    array([[[1, 4]],
           [[2, 5]],
           [[3, 6]]])