hstack#
- ivy.hstack(arrays, /, *, out=None)[source]#
Stack arrays in sequence horizotally (column wise).
- Parameters:
arrays (
Sequence
[Array
]) – Sequence of arrays to be stacked.- Return type:
- Returns:
ret – The array formed by stacking the given arrays.
Examples
>>> x = ivy.array([1, 2, 3]) >>> y = ivy.array([2, 3, 4]) >>> ivy.hstack((x, y)) ivy.array([1, 2, 3, 2, 3, 4]) >>> x = ivy.array([1, 2, 3]) >>> y = ivy.array([0, 0, 0]) >>> ivy.hstack((x, y, x)) ivy.array([1, 2, 3, 0, 0, 0, 1, 2, 3]) >>> y = [ivy.array([[5, 6]]), ivy.array([[7, 8]])] >>> print(ivy.hstack(y)) ivy.array([[5, 6, 7, 8]])
- Array.hstack(self, arrays, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.hstack. This method simply wraps the function, and so the docstring for ivy.hstack 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.hstack(self, /, xs, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.hstack. This method simply wraps the function, and so the docstring for ivy.hstack 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]])) >>> z = x.hstack([y]) >>> print(z) { a: ivy.array([[0, 1, 3, 2], [2, 3, 1, 0]]), b: ivy.array([[4, 5, 1, 0]]) }