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:
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:

usm_ndarray