piiswrong commented on a change in pull request #10315: [MXNET-249] Add inplace 
support to mkldnn sum
URL: https://github.com/apache/incubator-mxnet/pull/10315#discussion_r178621496
 
 

 ##########
 File path: src/operator/nn/mkldnn/mkldnn_sum.cc
 ##########
 @@ -49,23 +49,42 @@ void Sum(const mkldnn::memory &arr1, const mkldnn::memory 
&arr2,
 void MKLDNNSumForward(const nnvm::NodeAttrs& attrs, const OpContext &ctx,
                       const std::vector<NDArray> &inputs, const OpReqType &req,
                       const NDArray &out_data) {
+  if (req == kNullOp) {
+    return;
+  }
+
   TmpMemMgr::Get()->Init(ctx.requested[0]);
   std::vector<mkldnn::primitive::at> in_prims;
   std::vector<mkldnn::memory::primitive_desc> in_pds(inputs.size());
   std::vector<float> scales(inputs.size(), 1);
   in_prims.reserve(inputs.size());
+  bool pd_same = true;
   for (size_t i = 0; i < inputs.size(); i++) {
     auto in_mem = inputs[i].GetMKLDNNData();
     in_prims.push_back(*in_mem);
     in_pds[i] = in_mem->get_primitive_desc();
+    // pd_same = pd_same && (in_pds[i] == in_pds[0]);
 
 Review comment:
   please remove the code instead of commenting it out

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

Reply via email to