Skip to content

Commit 8b23918

Browse files
authored
Merge pull request #10181 from abhinavarora/cpplint_advanced
Fix CPPLint errors with framework/op_desc
2 parents 3fdfa94 + edd3587 commit 8b23918

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

paddle/fluid/framework/op_desc.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,8 @@ void OpDesc::SetAttr(const std::string &name, const Attribute &v) {
205205
need_update_ = true;
206206
}
207207

208-
void OpDesc::SetBlockAttr(const std::string &name, BlockDesc &block) {
209-
this->attrs_[name] = █
208+
void OpDesc::SetBlockAttr(const std::string &name, BlockDesc *block) {
209+
this->attrs_[name] = block;
210210
need_update_ = true;
211211
}
212212

paddle/fluid/framework/op_desc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ limitations under the License. */
1414

1515
#pragma once
1616

17+
#include <string>
1718
#include <unordered_map>
1819
#include <vector>
1920
#include "paddle/fluid/framework/attribute.h"
@@ -73,7 +74,7 @@ class OpDesc {
7374

7475
void SetAttr(const std::string &name, const Attribute &v);
7576

76-
void SetBlockAttr(const std::string &name, BlockDesc &block);
77+
void SetBlockAttr(const std::string &name, BlockDesc *block);
7778

7879
Attribute GetAttr(const std::string &name) const;
7980

paddle/fluid/framework/program_desc.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ ProgramDesc::ProgramDesc(const ProgramDesc &o) {
5656
for (const auto &attr : op->Proto()->attrs()) {
5757
if (attr.type() == proto::AttrType::BLOCK) {
5858
size_t blk_idx = attr.block_idx();
59-
op->SetBlockAttr(attr.name(), *this->MutableBlock(blk_idx));
59+
op->SetBlockAttr(attr.name(), this->MutableBlock(blk_idx));
6060
}
6161
}
6262
}
@@ -73,7 +73,7 @@ ProgramDesc::ProgramDesc(const proto::ProgramDesc &desc) {
7373
for (const auto &attr : op->Proto()->attrs()) {
7474
if (attr.type() == proto::AttrType::BLOCK) {
7575
size_t blk_idx = attr.block_idx();
76-
op->SetBlockAttr(attr.name(), *this->MutableBlock(blk_idx));
76+
op->SetBlockAttr(attr.name(), this->MutableBlock(blk_idx));
7777
}
7878
}
7979
}

paddle/fluid/operators/conditional_block_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class ConditionalBlockGradMaker : public framework::SingleGradOpDescMaker {
227227
grad_op->SetOutput(framework::GradVarName("X"), InputGrad("X", false));
228228
grad_op->SetOutput(framework::GradVarName("Params"),
229229
InputGrad("Params", false));
230-
grad_op->SetBlockAttr("sub_block", *this->grad_block_[0]);
230+
grad_op->SetBlockAttr("sub_block", this->grad_block_[0]);
231231
grad_op->SetAttr("is_scalar_condition", GetAttr("is_scalar_condition"));
232232
return std::unique_ptr<framework::OpDesc>(grad_op);
233233
}

paddle/fluid/operators/parallel_do_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ class ParallelDoGradOpDescMaker : public framework::SingleGradOpDescMaker {
364364
}
365365
}
366366
grad->SetAttrMap(this->Attrs());
367-
grad->SetBlockAttr(kParallelBlock, *grad_block_[0]);
367+
grad->SetBlockAttr(kParallelBlock, grad_block_[0]);
368368

369369
return std::unique_ptr<framework::OpDesc>(grad);
370370
}

paddle/fluid/operators/recurrent_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ class RecurrentGradOpDescMaker : public framework::SingleGradOpDescMaker {
596596
}
597597
}
598598
grad->SetAttrMap(this->Attrs());
599-
grad->SetBlockAttr(kStepBlock, *grad_block_[0]);
599+
grad->SetBlockAttr(kStepBlock, grad_block_[0]);
600600

601601
return std::unique_ptr<framework::OpDesc>(grad);
602602
}

paddle/fluid/operators/while_op.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class WhileGradOpDescMaker : public framework::SingleGradOpDescMaker {
288288
while_grad->SetInput(framework::GradVarName(kOutputs), output_grads_list);
289289

290290
while_grad->SetAttrMap(this->Attrs());
291-
while_grad->SetBlockAttr(kStepBlock, *grad_block);
291+
while_grad->SetBlockAttr(kStepBlock, grad_block);
292292
// record the original output gradient names, since the gradient name of
293293
// while operator could be renamed.
294294
while_grad->SetAttr("original_output_grad", output_grads_list);

0 commit comments

Comments
 (0)