dstack#

ivy.dstack(arrays, /, *, out=None)[source]#

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

Parameters:

arrays (Sequence[Array]) – Sequence of arrays to be stacked.

Return type:

Array

Returns:

ret – The array formed by stacking the given arrays.

Examples

>>> x = ivy.array([1, 2, 3])
>>> y = ivy.array([2, 3, 4])
>>> ivy.dstack((x, y))
ivy.array([[[1, 2],
            [2, 3],
            [3, 4]]])
>>> x = ivy.array([[1], [2], [3]])
>>> y = ivy.array([[2], [3], [4]])
>>> ivy.dstack((x, y))
ivy.array([[[1, 2]],
           [[2, 3]],
           [[3, 4]]])
Array.dstack(self, arrays, /, *, out=None)[source]#

ivy.Array instance method variant of ivy.dstack. This method simply wraps the function, and so the docstring for ivy.dstack also applies to this method with minimal changes.

Return type:

Array

Examples

>>> x = ivy.array([1, 2, 3])
>>> y = ivy.array([2, 3, 4])
>>> x.dstack(y)
ivy.array([[[1, 2],
            [2, 3],
            [3, 4]]])
Container.dstack(self, /, xs, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

ivy.Container instance method variant of ivy.stack. This method simply wraps the function, and so the docstring for ivy.stack also applies to this method with minimal changes.

Return type:

Container

Examples

>>> x = ivy.Container(a=ivy.array([[0, 1], [2,3]]), b=ivy.array([[4, 5]]))
>>> y = ivy.Container(a=ivy.array([[3, 2], [1,0]]), b=ivy.array([[1, 0]]))
>>> x.dstack([y])
{
    a: ivy.array([[[0, 3],
                   [1, 2]],
                  [[2, 1],
                   [3, 0]]]),
    b: ivy.array([[[4, 1]],
                   [[5, 0]]])
}