Skip to content

Commit 55218da

Browse files
committed
add prependAllocatedop
1 parent 95a28d1 commit 55218da

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

paddle/fluid/framework/block_desc.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ OpDesc *BlockDesc::PrependOp() {
135135
return ops_.front().get();
136136
}
137137

138+
void BlockDesc::PrependAllocatedOp(std::unique_ptr<OpDesc> &&op_desc) {
139+
need_update_ = true;
140+
ops_.emplace_front(std::move(op_desc));
141+
}
142+
138143
void BlockDesc::RemoveOp(size_t s, size_t e) {
139144
if (ops_.begin() + s == ops_.end() || ops_.begin() + e == ops_.end()) {
140145
return;

paddle/fluid/framework/block_desc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class BlockDesc {
8787

8888
OpDesc *PrependOp();
8989

90+
void PrependAllocatedOp(std::unique_ptr<OpDesc> &&op_desc);
91+
9092
void RemoveOp(size_t s, size_t e);
9193

9294
std::vector<OpDesc *> AllOps() const;

0 commit comments

Comments
 (0)