Change fetch op

helinwang-patch-1
Yu Yang 7 years ago
parent 76570c2e96
commit 222763296f

@ -33,11 +33,6 @@ void FetchOpHandle::Wait(platform::DeviceContext *waited_dev) {
}
void FetchOpHandle::WaitAndMergeCPUTensors() const {
// Wait fetch stream done.
for (auto &ctx : dev_ctx_) {
ctx.second->Wait();
}
std::vector<const LoDTensor *> tensors_ptr;
tensors_ptr.reserve(tensors_.size());
for (auto &t : tensors_) {
@ -72,6 +67,8 @@ void FetchOpHandle::RunImpl() {
tensors_[i].ShareDataWith(t);
tensors_[i].set_lod(t.lod());
}
this->WaitAndMergeCPUTensors();
}
}

@ -96,12 +96,6 @@ FeedFetchList ThreadedSSAGraphExecutor::Run(
for (auto *var : vars) {
op->AddInput(var);
}
dummy_vars.emplace_back();
auto *var = &dummy_vars.back();
var->generated_op_ = nullptr;
op->AddOutput(var);
InsertPendingVar(*var);
InsertPendingOp(*op);
}
@ -176,8 +170,7 @@ FeedFetchList ThreadedSSAGraphExecutor::Run(
};
// Wait FetchOps.
for (auto &fetch_op : fetch_ops) {
fetch_op.WaitAndMergeCPUTensors();
if (!fetch_ops.empty()) {
sync_computation();
}

Loading…
Cancel
Save