leezu commented on issue #19672:
URL: 
https://github.com/apache/incubator-mxnet/issues/19672#issuecomment-745043940


   > We may need to find a way to make our containers capable of holding 
NDArrays. FFI containers are mainly adapted from TVM and can only hold 
ObjectRefs from object system. Different from TVM's NDArray, which inherits 
from ObjectRef and there is customized smart pointer called ObjectPtr to count 
references, NDArray in MXNet uses shared pointer to hold internal data. Holding 
NDArray in container requires NDArrayHandle can affect NDArray's reference 
counting.
   
   It seems that the key difference between the TVM NDArray and MXNet NDArray 
wrt to FFI is that in TVM, the Ref will own a copy of the NDArray, whereas in 
the current implementation, MXNet NDArrayHandle in the FFI only owns a pointer 
to the underlying array. Changing the MXNet FFI to also own the underlying 
NDArray (copy constructor instead of pointer) should resolve the issue. Copy of 
the MXNet array would be cheap, as it only holds some metadata information and 
a shared pointer to the underlying storage chunk. WDYT?


----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to