You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/06/26 05:53:12 UTC
[GitHub] pengzhao-intel commented on a change in pull request #11129:
[MXNET-497] fix bugs in MKLDNN operators to handle the kAddTo request
pengzhao-intel commented on a change in pull request #11129: [MXNET-497] fix bugs in MKLDNN operators to handle the kAddTo request
URL: https://github.com/apache/incubator-mxnet/pull/11129#discussion_r198020569
##########
File path: src/operator/nn/mkldnn/mkldnn_base.cc
##########
@@ -141,13 +212,16 @@ 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);
- // We have to allocate new memory for the sum result.
- auto sum_res = TmpMemMgr::Get()->Alloc(
- res.second->get_primitive_desc());
- op::MKLDNNSum(*res.second, *mem, *sum_res);
- const_cast<NDArray &>(arr).CopyFrom(*sum_res);
+ if (mem == nullptr) {
+ auto tmp_memory = TmpMemMgr::Get()->Alloc(target_pd);
+ MKLDNNCopy(*res_memory, tmp_memory);
+ res_memory = tmp_memory;
Review comment:
As my understanding, `MKLDNNCopy` already reordered the `res_memory` with `tmp_memory`, so why we need to assign `tmp_memory` to `res_memory` again?
----------------------------------------------------------------
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