dpnp.ndarray.copy
method
- ndarray.copy(order='C', *, device=None, usm_type=None, sycl_queue=None)
Return a copy of the array.
Refer to
dpnp.copyfor full documentation.- Parameters:
order ({None, "C", "F", "A", "K"}, optional) --
Memory layout of the newly output array.
Default:
"C".device ({None, string, SyclDevice, SyclQueue, Device}, optional) --
An array API concept of device where the output array is created. device can be
None, a oneAPI filter selector string, an instance ofdpctl.SyclDevicecorresponding to a non-partitioned SYCL device, an instance ofdpctl.SyclQueue, or adpctl.tensor.Deviceobject returned bydpnp.ndarray.device.Default:
None.usm_type ({None, "device", "shared", "host"}, optional) --
The type of SYCL USM allocation for the output array.
Default:
None.sycl_queue ({None, SyclQueue}, optional) --
A SYCL queue to use for output array allocation and copying. The sycl_queue can be passed as
None(the default), which means to get the SYCL queue from device keyword if present or to use a default queue.Default:
None.
- Returns:
out -- A copy of the array.
- Return type:
dpnp.ndarray
See also
dpnp.copySimilar function with different default behavior
dpnp.copytoCopies 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