Closed
Description
Since #741 was merged, it should now be possible to perform data transfers across devices and namespaces in a standard, namespace agnostic way (as long as both namespace have a shared understanding of a common device type, such as the CPU/host).
However, such transfers cannot reuse pre-allocated buffers in the target namespace/device.
Would it be possible to add an out
argument to from_dlpack
?
def move(x, y):
xp_x = x.__array_namespace__()
xp_y = y.__array_namespace__()
if not xp_x == xp_y:
xp_x.from_dlpack(y, copy=True, out=x) # device=x.device is implicit in this case.
else:
x[:] = y
This API might be a bit too weird. I am open a to better suggestions.
Metadata
Metadata
Assignees
Labels
No labels