From 55218dafbc6831da485b63c4180cd44d8dc8c8ef Mon Sep 17 00:00:00 2001 From: Yao Cheng Date: Tue, 8 May 2018 10:38:57 +0800 Subject: [PATCH] add prependAllocatedop --- paddle/fluid/framework/block_desc.cc | 5 +++++ paddle/fluid/framework/block_desc.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/paddle/fluid/framework/block_desc.cc b/paddle/fluid/framework/block_desc.cc index d72b64700f7..90cbe7ae136 100644 --- a/paddle/fluid/framework/block_desc.cc +++ b/paddle/fluid/framework/block_desc.cc @@ -135,6 +135,11 @@ OpDesc *BlockDesc::PrependOp() { return ops_.front().get(); } +void BlockDesc::PrependAllocatedOp(std::unique_ptr &&op_desc) { + need_update_ = true; + ops_.emplace_front(std::move(op_desc)); +} + void BlockDesc::RemoveOp(size_t s, size_t e) { if (ops_.begin() + s == ops_.end() || ops_.begin() + e == ops_.end()) { return; diff --git a/paddle/fluid/framework/block_desc.h b/paddle/fluid/framework/block_desc.h index 3bd90f38907..5325583b193 100644 --- a/paddle/fluid/framework/block_desc.h +++ b/paddle/fluid/framework/block_desc.h @@ -87,6 +87,8 @@ class BlockDesc { OpDesc *PrependOp(); + void PrependAllocatedOp(std::unique_ptr &&op_desc); + void RemoveOp(size_t s, size_t e); std::vector AllOps() const; -- GitLab