dpnp.dpnp_array.dpnp_array.copy
method
- dpnp_array.copy(order='C', device=None, usm_type=None, sycl_queue=None)[source]
Return a copy of the array.
Refer to
dpnp.copy
for full documentation.- Parameters:
order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array. Default:
"C"
.device ({None, string, SyclDevice, SyclQueue}, optional) -- An array API concept of device where the output array is created. The device can be
None
(the default), an OneAPI filter selector string, an instance ofdpctl.SyclDevice
corresponding to a non-partitioned SYCL device, an instance ofdpctl.SyclQueue
, or a Device object returned bydpnp.dpnp_array.dpnp_array.device
property. 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.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