Stack tensors in sequence depth wise (along third axis).
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).
Args |
xs
|
Sequence of tensors.
|
Returns |
|
The tensor formed by stacking the given tensors.
|
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]]])