azai91 commented on a change in pull request #11129: [MXNET-497]Test kAddTo 
request for mkldnn operators
URL: https://github.com/apache/incubator-mxnet/pull/11129#discussion_r194869335
 
 

 ##########
 File path: src/operator/nn/mkldnn/mkldnn_base.cc
 ##########
 @@ -128,12 +201,18 @@ void CommitOutput(const NDArray &arr, const 
mkldnn_output_t &res) {
   if (res.first == CopyBack) {
     const_cast<NDArray &>(arr).CopyFrom(*res.second);
   } else if (res.first == AddBack) {
+    auto res_memory = res.second;
+    auto target_pd = arr.GetMKLDNNData()->get_primitive_desc();
     auto mem = arr.GetMKLDNNData(res.second->get_primitive_desc());
-    CHECK(mem != nullptr);
+    if (mem == nullptr) {
+      auto tmp_memory = TmpMemMgr::Get()->Alloc(target_pd);
+      CopyMKLDNNMem(*res_memory, tmp_memory);
 
 Review comment:
   the purpose of this block is coerce the input memory (`res`) to the same 
size as the output ndarray's memory. the issue here is that we do not have the 
ndarray of the input, only the memory in `res.second` so we don't have the 
`GetMKLDNNDataReorder` member function.
   
   

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