zheng-da commented on a change in pull request #10591: handle inplace in mkldnn 
FallBackCompute
URL: https://github.com/apache/incubator-mxnet/pull/10591#discussion_r182308827
 
 

 ##########
 File path: src/operator/nn/mkldnn/mkldnn_base.cc
 ##########
 @@ -294,7 +294,9 @@ void FallBackCompute(FCompute fn, const nnvm::NodeAttrs 
&attrs,
 
   std::vector<TBlob> out_blobs(outputs.size());
   for (size_t i = 0; i < out_blobs.size(); i++) {
-    if (req[i] == kWriteTo)
+    // ensure output does not use mkldnn mem.
+    // for inplace, we already converted & copied input above.
+    if ((req[i] == kWriteTo) || (req[i] == kWriteInplace))
       const_cast<NDArray &>(outputs[i]).InvalidateMKLDNNData();
 
 Review comment:
   Actually, we need to handle kAddTo properly here as well. If it's kAddTo, we 
can convert the layout of the output array to the default format directly. 
since it's output array, we expect its memory will be written.

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