concat_from_sequence#
- ivy.concat_from_sequence(input_sequence, /, *, new_axis=0, axis=0, out=None)[source]#
Concatenate a sequence of arrays along a new or an existing axis.
- Parameters:
input_sequence (
Union
[Tuple
[Union
[Array
,NativeArray
]],List
[Union
[Array
,NativeArray
]]]) – A sequence of arrays.new_axis (
int
) – Insert and concatenate on a new axis or not, (default:0
) default 0 means do not insert new axis. new_axis = 0: concatenate new_axis = 1: stackaxis (
int
) – axis along which the arrays will be concatenated. (default:0
)out (
Optional
[Array
]) – optional output array, for writing the result to. (default:None
)
- Return type:
- Returns:
ret – Output Array
- Array.concat_from_sequence(self, /, input_sequence, *, new_axis=0, axis=0, out=None)#
Concatenate a sequence of arrays along a new or an existing axis.
- Parameters:
self (
Array
) – Array input.input_sequence (
Union
[Tuple
[Union
[Array
,NativeArray
]],List
[Union
[Array
,NativeArray
]]]) – A sequence of arrays.new_axis (
int
) – Insert and concatenate on a new axis or not, (default:0
) default 0 means do not insert new axis. new_axis = 0: concatenate new_axis = 1: stackaxis (
int
) – The axis along which the arrays will be concatenated. (default:0
)out (
Optional
[Array
]) – Optional output array, for writing the result to. (default:None
)
- Return type:
Array
- Returns:
ret – Output Array
- Container.concat_from_sequence(self, /, input_sequence, *, new_axis=0, axis=0, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)#
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.
- Parameters:
self (
Container
) –- Container with leaves to join with leaves of other arrays/containers.
Each array leave must have the same shape.
input_sequence (
Union
[Tuple
[Union
[Array
,NativeArray
,Container
]],List
[Union
[Array
,NativeArray
,Container
]]]) – Container with other leaves to join. Each array leave must have the same shape.new_axis (
int
) – Insert and concatenate on a new axis or not, (default:0
) default 0 means do not insert new axis. new_axis = 0: concatenate new_axis = 1: stackaxis (
int
) – axis along which the array leaves will be concatenated. More details can (default:0
) be found in the docstring for ivy.stack.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
]]]) – The key-chains to apply or not apply the method to. Default isNone
. (default:None
)to_apply (
bool
) – If True, the method will be applied to key_chains, otherwise key_chains (default:True
) will be skipped. Default isTrue
.prune_unapplied (
bool
) – Whether to prune key_chains for which the function was not applied. (default:False
) Default isFalse
.map_sequences (
bool
) – Whether to also map method to sequences (lists, tuples). (default:False
) Default isFalse
.out (
Optional
[Container
]) – optional output array, for writing the result to. It must have a shape (default:None
) that the inputs broadcast to.
- Return type:
Container
- Returns:
ret – an output container with the results.
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 = ivy.Container.static_concat_from_sequence([x,y],axis=1) >>> print(z) { a: ivy.array([[[0, 1], [3, 2]], [[2, 3], [1, 0]]]), b: ivy.array([[[4, 5], [1, 0]]]) }