ivy.stack(xs: List[ivy.NativeArray], axis: int = 0, f: Optional[ivy.Framework] = None) → ivy.NativeArray[source]

Joins a sequence of arrays along a new axis. The axis parameter specifies the index of the new axis in the dimensions of the result. For example, if axis: int = 0, it will be the first dimension and if axis: int = -1, it will be the last dimension.

  • xs (sequence of arrays) – Input arrays, each array must have the same shape.

  • axis (int, optional) – The axis in the result array along which the input arrays are stacked.

  • f (ml_framework, optional) – Machine learning framework. Inferred from inputs if None.


The stacked array has one more dimension than the input arrays.

Supported Frameworks:

empty jax_logo empty tf_logo empty pytorch_logo empty mxnet_logo empty numpy_logo empty