Closed
Description
It seems that when a strict array is created using from_dlpack
, its device
property is not set as I would expect. Consequently, strict arrays created with from_dlpack
cannot operate with strict arrays that were not created with from_dlpack
.
import array_api_strict as xp
x = xp.asarray([1, 2, 3])
y = xp.from_dlpack(x)
x * y
# ValueError: Arrays from two different devices (array_api_strict.Device('CPU_DEVICE') and <object object at 0x111f86f90>) can not be combined.
x.device # array_api_strict.Device('CPU_DEVICE')
y.device # <object at 0x111f86f90>
I actually encountered this problem when from_dlpack
is used on a NumPy array.
import numpy as np
import array_api_strict as xp
x = xp.asarray([1, 2, 3])
y = xp.from_dlpack(np.asarray([2, 3, 4]))
x * y # same problem
Crossref scipy/scipy#21890
Metadata
Metadata
Assignees
Labels
No labels