提交 22276329 编写于 作者: Y Yu Yang

Change fetch op

上级 76570c2e
......@@ -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();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册