File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -718,6 +718,11 @@ class _numpy_array_interface_wrapper:
718
718
self._memory_owner = memory_owner
719
719
720
720
721
+ cdef bint _is_kdlcpu_device(DLDevice *dev ):
722
+ " Check if DLTensor.DLDevice denotes (kDLCPU, 0)"
723
+ return (dev.device_type == kDLCPU) and (dev.device_id == 0 )
724
+
725
+
721
726
cpdef object from_dlpack_capsule(object py_caps):
722
727
"""
723
728
from_dlpack_capsule(py_caps)
@@ -915,7 +920,7 @@ cpdef object from_dlpack_capsule(object py_caps):
915
920
if readonly:
916
921
res_ary.flags_ = (res_ary.flags_ & ~ USM_ARRAY_WRITABLE)
917
922
return res_ary
918
- elif dl_tensor.device.device_type == kDLCPU :
923
+ elif _is_kdlcpu_device( & dl_tensor.device) :
919
924
ary_iface = _numpy_array_interface_from_dl_tensor(dl_tensor, readonly)
920
925
if not versioned:
921
926
dlm_holder = _DLManagedTensorOwner._create(dlm_tensor)
You can’t perform that action at this time.
0 commit comments