dpnp.concat
- dpnp.concat(arrays, /, *, axis=0, out=None, dtype=None, casting='same_kind')
Join a sequence of arrays along an existing axis.
Note that
dpnp.concat
is 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.
dtype (str or dtype) -- If provided, the destination array will have this dtype. Cannot be provided together with out.
casting ({'no', 'equiv', 'safe', 'same_kind', 'unsafe'}, optional) -- Controls what kind of data casting may occur. Defaults to 'same_kind'.
- Returns:
out -- The concatenated array.
- Return type:
dpnp.ndarray
See also
dpnp.array_split
Split an array into multiple sub-arrays of equal or near-equal size.
dpnp.split
Split array into a list of multiple sub-arrays of equal size.
dpnp.hsplit
Split array into multiple sub-arrays horizontally (column wise).
dpnp.vsplit
Split array into multiple sub-arrays vertically (row wise).
dpnp.dsplit
Split array into multiple sub-arrays along the 3rd axis (depth).
dpnp.stack
Stack a sequence of arrays along a new axis.
dpnp.block
Assemble arrays from blocks.
dpnp.hstack
Stack arrays in sequence horizontally (column wise).
dpnp.vstack
Stack arrays in sequence vertically (row wise).
dpnp.dstack
Stack arrays in sequence depth wise (along third dimension).
dpnp.column_stack
Stack 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])