wkcn commented on a change in pull request #12047: [MXNET-779]Add DLPack Transformation API URL: https://github.com/apache/incubator-mxnet/pull/12047#discussion_r209418577
########## File path: src/c_api/c_api.cc ########## @@ -500,6 +500,33 @@ int MXNDArrayGetData(NDArrayHandle handle, API_END(); } +int MXNDArrayToDLPack(NDArrayHandle handle, + DLManagedTensorHandle *out_dlpack) { + API_BEGIN(); + NDArray *arr = static_cast<NDArray*>(handle); + *out_dlpack = arr->ToDLPack(); + API_END(); +} + +int MXNDArrayFromDLPack(DLManagedTensorHandle dlpack, + NDArrayHandle *out_handle) { + API_BEGIN(); + NDArray *pdata = new NDArray(); + *pdata = NDArray::FromDLPack( Review comment: Does it need Rvalue Referene? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services