Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
inplace sum.
Browse files Browse the repository at this point in the history
  • Loading branch information
zheng-da committed Mar 29, 2018
1 parent c8db046 commit 8cce42e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/operator/nn/mkldnn/mkldnn_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,8 @@ void CommitOutput(const NDArray &arr, const mkldnn_output_t &res) {
} else if (res.first == AddBack) {
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::Sum(*res.second, *mem, *sum_res);
const_cast<NDArray &>(arr).CopyFrom(*sum_res);
CHECK(mem->get_primitive_desc() == res.second->get_primitive_desc());
op::Sum(*res.second, *mem, *mem);
}
}

Expand Down

0 comments on commit 8cce42e

Please sign in to comment.