Fix fromDlpack memory management
The DLManagedTensor interface has a "deleter" function that
is used to signal the creator of the DLManagedTensor that
the consumer does not need the memory anymore.
This tiny patch calls the deleter when the DLPackMemory
created by fromDlpack is destroyed.
@@ -154,6 +154,7 @@ cdef class DLPackMemory(memory.Memory):
def __dealloc__(self):
# DLPack tensor should be managed by the original creator
self.ptr = 0
+ self.dlm_tensor.deleter(self.dlm_tensor)
# The name of this function is following the framwork integration guide of
