vstack#

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

Stack arrays in sequence vertically (row wise).

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.vstack((x, y))
ivy.array([[1, 2, 3],
       [2, 3, 4]])
>>> ivy.vstack((x, y, x, y))
ivy.array([[1, 2, 3],
           [2, 3, 4],
           [1, 2, 3],
           [2, 3, 4]])
>>> y = [ivy.array([[5, 6]]), ivy.array([[7, 8]])]
>>> print(ivy.vstack(y))
ivy.array([[5, 6],
           [7, 8]])
Array.vstack(self, arrays, /, *, out=None)[source]#

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

Return type:

Array

Examples

>>> x = ivy.array([[1, 2]])
>>> y = [ivy.array([[5, 6]]), ivy.array([[7, 8]])]
>>> print(x.vstack(y))
    ivy.array([[1, 2],
               [5, 6],
               [7, 8]])
Container.vstack(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.vstack([y])
{
    a: ivy.array([[[0, 1],
                [2, 3]],
                [[3, 2],
                [1, 0]]]),
    b: ivy.array([[[4, 5]],
                [[1, 0]]])
}