concat#

ivy.concat(xs, /, *, axis=0, out=None)[source]#

Join a sequence of arrays along an existing axis.

Parameters:
  • xs (Union[Tuple[Union[Array, NativeArray], ...], List[Union[Array, NativeArray]]]) – input arrays to join. The arrays must have the same shape, except in the dimension specified by axis.

  • axis (int, default: 0) – axis along which the arrays will be joined. If axis is None, arrays are flattened before concatenation. If axis is negative, the axis is along which to join is determined by counting from the last dimension. Default: 0.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an output array containing the concatenated values. If the input arrays have different data types, normal Type Promotion Rules apply.

This function conforms to the Array API Standard. This docstring is an extension of the docstring in the standard.

Both the description and the type hints above assumes an array input for simplicity, but this function is nestable, and therefore also accepts ivy.Container instances in place of any of the arguments.

Examples

>>> x = ivy.array([[1, 2], [3, 4]])
>>> y = ivy.array([[5, 6]])
>>> ivy.concat((x, y))
ivy.array([[1, 2],[3, 4],[5, 6]])
Array.concat(self, xs, /, *, axis=0, out=None)[source]#

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

Parameters:
  • self (Array) – input array to join with other arrays xs.

  • xs (Union[Tuple[Union[Array, NativeArray], ...], List[Union[Array, NativeArray]]]) – The other arrays to join with. The arrays must have the same shape, except in the dimension specified by axis.

  • axis (int, default: 0) – axis along which the arrays will be joined. If axis is None, arrays must be flattened before concatenation. If axis is negative, axis on which to join arrays is determined by counting from the top. Default: 0.

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – an output array containing the concatenated values.

Container.concat(self, /, xs, *, axis=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

ivy.Container instance method variant of ivy.concat.

This method simply wraps the function, and so the docstring for ivy.concat also applies to this method with minimal changes.

Return type:

Container