Skip to content

Commit 2a5ecb6

Browse files
committed
follow comment. test=develop
1 parent 9f693fc commit 2a5ecb6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

paddle/fluid/framework/details/inplace_op_pass.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,13 @@ void InplacePass::TryInplaceOpInputOutput(ir::Node* op,
266266
VLOG(4) << "Try to inplace op " << op->Name();
267267
PADDLE_ENFORCE(op->Op() != nullptr && op->Op()->Block() != nullptr,
268268
"op_desc is nullptr");
269-
// 4 pre-requirments need to meet if the op want to inplaced.
270-
// 1. infer_inplace_ is registered.
269+
// some pre-requirments need to meet if the op want to inplaced.
270+
271271
auto* op_desc = op->Op();
272272
auto& infer_inplace =
273273
OpInfoMap::Instance().Get(op_desc->Type()).infer_inplace_;
274+
275+
// 1. infer_inplace_ is registered.
274276
if (!static_cast<bool>(infer_inplace)) return;
275277
PADDLE_ENFORCE(static_cast<bool>(infer_inplace),
276278
"%s's infer_inplace has not been registered", op_desc->Type());
@@ -399,7 +401,7 @@ void GraphView::Build(ir::Graph* g) {
399401
}
400402
}
401403

402-
const std::vector<ir::Node*> GraphView::AllOps() { return ops_; }
404+
const& std::vector<ir::Node*> GraphView::AllOps() { return ops_; }
403405

404406
bool GraphView::ReusedInPythonMemOpt(const std::string& var) const {
405407
return dup_nodes_.count(var);

paddle/fluid/framework/details/inplace_op_pass.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class GraphView {
3333

3434
void Build(ir::Graph* g);
3535

36-
const std::vector<ir::Node*> AllOps();
36+
const& std::vector<ir::Node*> AllOps();
3737

3838
ir::Node* GetNodeByName(const std::string& name,
3939
const std::vector<ir::Node*>& nodes) const;

0 commit comments

Comments
 (0)