dpnp.ndarray.copy

ndarray.copy(order='C')

Return a copy of the array.

Returns:

out -- A copy of the array.

Return type:

dpnp.ndarray

See also

dpnp.copy

Similar function with different default behavior

dpnp.copyto

Copies values from one array to another.

Notes

This function is the preferred method for creating an array copy. The function dpnp.copy() is similar, but it defaults to using order 'K'.

Examples

>>> import dpnp as np
>>> x = np.array([[1, 2, 3], [4, 5, 6]], order='F')
>>> y = x.copy()
>>> x.fill(0)
>>> x
array([[0, 0, 0],
       [0, 0, 0]])
>>> y
array([[1, 2, 3],
       [4, 5, 6]])
>>> y.flags['C_CONTIGUOUS']
True