dpctl.tensor.usm_ndarray.to_device¶
- usm_ndarray.to_device(target_device)¶
Transfers this array to specified target device.
- Example:
import dpctl import dpctl.tensor as dpt x = dpt.full(10**6, 2, dtype="int64") q_prof = dpctl.SyclQueue( x.sycl_device, property="enable_profiling") # return a view with profile-enabled queue y = x.to_device(q_prof) timer = dpctl.SyclTimer() with timer(q_prof): z = y * y print(timer.dt)
- Parameters:
target_device (object) – Array API concept of target device. It can be a oneAPI filter selector string, an instance of
dpctl.SyclDevice
corresponding to a non-partitioned SYCL device, an instance ofdpctl.SyclQueue
, or adpctl.tensor.Device
object returned bydpctl.tensor.usm_ndarray.device
.stream (
dpctl.SyclQueue
, optional) – Execution queue to synchronize with. IfNone
, synchronization is not performed.
- Returns:
A view if data copy is not required, and a copy otherwise. If copying is required, it is done by copying from the original allocation device to the host, followed by copying from host to the target device.
- Return type: