dpnp.ndarray.flatten

ndarray.flatten(order='C')

Return a copy of the array collapsed into one dimension.

For full documentation refer to numpy.ndarray.flatten.

Parameters:

order ({"C", "F"}, optional) --

Read the elements using this index order, and place the elements into the reshaped array using this index order.

  • "C" means to read / write the elements using C-like index order, with the last axis index changing fastest, back to the first axis index changing slowest.

  • "F" means to read / write the elements using Fortran-like index order, with the first index changing fastest, and the last index changing slowest.

The default is "C".

Returns:

out -- A copy of the input array, flattened to one dimension.

Return type:

dpnp.ndarray

See also

dpnp.ravel

Return a flattened array.

dpnp.flat

A 1-D flat iterator over the array.

Examples

>>> import dpnp as np
>>> a = np.array([[1, 2], [3, 4]])
>>> a.flatten()
array([1, 2, 3, 4])
>>> a.flatten("F")
array([1, 3, 2, 4])