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_r182921389
########## File path: src/operator/nn/mkldnn/mkldnn_base.cc ########## @@ -294,10 +294,15 @@ 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) - const_cast<NDArray &>(outputs[i]).InvalidateMKLDNNData(); - CHECK(outputs[i].IsDefaultData()); - out_blobs[i] = outputs[i].data(); + NDArray output = outputs[i]; + // 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 &>(output).InvalidateMKLDNNData(); + if (req[i] == kAddTo) Review comment: could you make this "else if"? ---------------------------------------------------------------- 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