Skip to content

Commit

Permalink
Fix sum op fails as no memory in tensor(PaddlePaddle#20602)
Browse files Browse the repository at this point in the history
test=develop

Signed-off-by: zhaoyuchen <zhaoyuchen01@baidu.com>
  • Loading branch information
zhaoyuchen2018 committed Oct 15, 2019
1 parent 496ba7a commit 0c22685
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion paddle/fluid/operators/sum_op.cu
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,10 @@ void SumToLoDTensor(const framework::ExecutionContext &context) {
for (int i = start; i < in_num; ++i) {
if (in_vars[i]->IsType<framework::LoDTensor>()) {
auto &in_i = in_vars[i]->Get<framework::LoDTensor>();
in_data.emplace_back(in_i.data<T>());
lod_length = in_i.numel();
if (lod_length && in_i.IsInitialized()) {
in_data.emplace_back(in_i.data<T>());
}
} else if (in_vars[i]->IsType<framework::SelectedRows>()) {
selectrow_index.push_back(i);
}
Expand Down

0 comments on commit 0c22685

Please sign in to comment.