You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
importarray_api_strictasxpx=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.
importnumpyasnpimportarray_api_strictasxpx=xp.asarray([1, 2, 3])
y=xp.from_dlpack(np.asarray([2, 3, 4]))
x*y# same problem
It seems that when a strict array is created using
from_dlpack
, itsdevice
property is not set as I would expect. Consequently, strict arrays created withfrom_dlpack
cannot operate with strict arrays that were not created withfrom_dlpack
.I actually encountered this problem when
from_dlpack
is used on a NumPy array.Crossref scipy/scipy#21890
The text was updated successfully, but these errors were encountered: