eric-haibin-lin commented on a change in pull request #11024: [MXNET-394] concat of CSR NDArrays on first dimension URL: https://github.com/apache/incubator-mxnet/pull/11024#discussion_r194191072
########## File path: src/operator/nn/concat-inl.h ########## @@ -154,6 +154,92 @@ void ConcatGradCompute(const nnvm::NodeAttrs& attrs, const OpContext& ctx, }); } +/*! + * \brief concat CSRNDArray on the first dimension. + */ +struct concat_csr_first_dim { + /*! + * \param i the i-th row of the input ndarray + * \param out_idx output csr ndarray column indices + * \param out_data output csr ndarray data + * \param out_indptr output csr ndarray row index pointer + * \param in_idx input csr ndarray column indices + * \param in_data input csr ndarray data + * \param in_indptr input csr ndarray row index pointer + * \param indptr_offset offset for ouput ndarray row index pointer + * \param idx_offset offset for ouput ndarray column indices + */ + template<typename DType, typename RType, typename IType> + MSHADOW_XINLINE static void Map(int i, const OpReqType req, + DType* out_data, const DType* in_data, + RType* out_indptr, const RType* in_indptr, + IType* out_idx, const IType* in_idx, + const nnvm::dim_t indptr_offset, + const nnvm::dim_t idx_offset) { + if (i == 0) out_indptr[0] = 0; + out_indptr[i+1+indptr_offset] = in_indptr[i+1] + idx_offset; + for (nnvm::dim_t j = in_indptr[i]; j < in_indptr[i+1]; ++j) { + KERNEL_ASSIGN(out_idx[j+idx_offset], req, in_idx[j]); + KERNEL_ASSIGN(out_data[j+idx_offset], req, in_data[j]); + } + } +}; + +template<typename xpu> +void ConcatRspImpl(const nnvm::NodeAttrs& attrs, Review comment: Is this CSR Impl or RSP impl?? ---------------------------------------------------------------- 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