junrushao1994 commented on a change in pull request #15016: [MXNET-1406] [BUG]
Fix DLManagedTensor deleter
URL: https://github.com/apache/incubator-mxnet/pull/15016#discussion_r285877370
##########
File path: python/mxnet/ndarray/ndarray.py
##########
@@ -4262,8 +4262,6 @@ def _make_dl_managed_tensor(array):
if not ndarray.flags['C_CONTIGUOUS']:
raise ValueError("Only c-contiguous arrays are supported for
zero-copy")
c_obj = _make_dl_managed_tensor(ndarray)
- address = ctypes.addressof(c_obj)
- address = ctypes.cast(address, ctypes.c_void_p)
handle = NDArrayHandle()
- check_call(_LIB.MXNDArrayFromDLPack(address, ctypes.byref(handle)))
+ check_call(_LIB.MXNDArrayFromDLPack(ctypes.byref(c_obj), True,
ctypes.byref(handle)))
Review comment:
bc the DLManagedTensor here is freed immediately after this call
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services