dpnp.concatenate
- dpnp.concatenate(arrays, /, *, axis=0, out=None, dtype=None, casting='same_kind')[source]
Join a sequence of arrays along an existing axis.
Note that
dpnp.concatis an alias ofdpnp.concatenate.For full documentation refer to
numpy.concatenate.- Parameters:
arrays ({Sequence of dpnp.ndarray or usm_ndarray}) -- The arrays must have the same shape, except in the dimension corresponding to axis (the first, by default).
axis (int, optional) --
The axis along which the arrays will be joined. If axis is
None, arrays are flattened before use.Default:
0.out (dpnp.ndarray, optional) --
If provided, the destination to place the result. The shape must be correct, matching that of what concatenate would have returned if no out argument were specified.
Default:
None.dtype ({None, str, dtype object}, optional) --
If provided, the destination array will have this dtype. Cannot be provided together with out.
Default:
None.casting ({'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional) --
Controls what kind of data casting may occur.
Default:
"same_kind".
- Returns:
out -- The concatenated array.
- Return type:
dpnp.ndarray
See also
dpnp.array_splitSplit an array into multiple sub-arrays of equal or near-equal size.
dpnp.splitSplit array into a list of multiple sub-arrays of equal size.
dpnp.hsplitSplit array into multiple sub-arrays horizontally (column wise).
dpnp.vsplitSplit array into multiple sub-arrays vertically (row wise).
dpnp.dsplitSplit array into multiple sub-arrays along the 3rd axis (depth).
dpnp.stackStack a sequence of arrays along a new axis.
dpnp.blockAssemble arrays from blocks.
dpnp.hstackStack arrays in sequence horizontally (column wise).
dpnp.vstackStack arrays in sequence vertically (row wise).
dpnp.dstackStack arrays in sequence depth wise (along third dimension).
dpnp.column_stackStack 1-D arrays as columns into a 2-D array.
Examples
>>> import dpnp as np >>> a = np.array([[1, 2], [3, 4]]) >>> b = np.array([[5, 6]]) >>> np.concatenate((a, b), axis=0) array([[1, 2], [3, 4], [5, 6]]) >>> np.concatenate((a, b.T), axis=1) array([[1, 2, 5], [3, 4, 6]]) >>> np.concatenate((a, b), axis=None) array([1, 2, 3, 4, 5, 6])