You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by gi...@git.apache.org on 2017/07/29 06:32:59 UTC

[GitHub] eric-haibin-lin commented on a change in pull request #7244: Operator add_n for row sparse ndarrays

eric-haibin-lin commented on a change in pull request #7244: Operator add_n for row sparse ndarrays
URL: https://github.com/apache/incubator-mxnet/pull/7244#discussion_r130213152
 
 

 ##########
 File path: src/operator/tensor/elemwise_unary_op.h
 ##########
 @@ -105,6 +105,38 @@ void IdentityComputeRspRspImpl(const nnvm::NodeAttrs& attrs,
 }
 
 template<typename xpu>
+void IdentityComputeEx(const nnvm::NodeAttrs& attrs,
+                       const OpContext& ctx,
+                       const std::vector<NDArray>& inputs,
+                       const std::vector<OpReqType>& req,
+                       const std::vector<NDArray>& outputs) {
+  CHECK_EQ(inputs.size(), 1U);
+  CHECK_EQ(outputs.size(), 1U);
+  CHECK_EQ(req.size(), 1U);
+  const auto in_stype = inputs[0].storage_type();
+  const auto out_stype = outputs[0].storage_type();
+  mshadow::Stream<xpu> *s = ctx.get_stream<xpu>();
+  if (in_stype == out_stype) {
+    if (in_stype == kDefaultStorage) {  // dense ndarray
+      IdentityCompute<xpu>(attrs, ctx, {inputs[0].data()}, req, {outputs[0].data()});
+    } else {  // sparse ndarray
 
 Review comment:
   Better check the stype explicitly since there'll be kMKLStorage in the future
 
----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services