guanxinq commented on a change in pull request #17569: Adding sparse support to
MXTensor for custom operators
URL: https://github.com/apache/incubator-mxnet/pull/17569#discussion_r393377786
##########
File path: include/mxnet/lib_api.h
##########
@@ -393,13 +453,21 @@ class OpResource {
return static_cast<mx_stream_t>(cuda_stream);
}
+ void alloc_sparse(MXSparse* sparse, int index, int indices_len, int
indptr_len = 0) {
+ sparse_malloc(sparse_alloc, index, indices_len, indptr_len,
+ &(sparse->data), &(sparse->indices), &(sparse->indptr));
+ }
+
private:
/*! \brief allocation lambda function */
xpu_malloc_t cpu_malloc, gpu_malloc;
/*! \brief lambda function to return allocated memory handle */
void *cpu_alloc, *gpu_alloc;
/*! \brief cuda stream passed from MXNet */
void *cuda_stream;
+
+ sparse_malloc_t sparse_malloc;
+ void *sparse_alloc;
Review comment:
Added.
----------------------------------------------------------------
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