Skip to content

Commit a0c4138

Browse files
committed
Polish Dctor
1 parent b0ca371 commit a0c4138

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

paddle/fluid/framework/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ cc_library(data_transform SRCS data_transform.cc DEPS math_function tensor
5757
cc_library(attribute SRCS attribute.cc DEPS framework_proto boost)
5858
cc_test(program_desc_test SRCS program_desc_test.cc DEPS proto_desc
5959
device_context)
60-
cc_library(op_proto_maker SRCS op_proto_maker.cc DEPS framework_proto attribute)
60+
cc_library(op_proto_maker SRCS op_proto_maker.cc DEPS framework_proto attribute glog)
6161
cc_test(op_proto_maker_test SRCS op_proto_maker_test.cc DEPS op_proto_maker)
6262
cc_library(op_info SRCS op_info.cc DEPS attribute framework_proto)
6363
cc_library(shape_inference SRCS shape_inference.cc DEPS ddim attribute device_context)

paddle/fluid/framework/op_proto_maker.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ limitations under the License. */
1414
#pragma once
1515

1616
#include <string>
17+
#include "glog/logging.h"
1718
#include "paddle/fluid/framework/attribute.h"
1819
#include "paddle/fluid/framework/framework.pb.h"
19-
2020
namespace paddle {
2121
namespace framework {
2222

@@ -26,59 +26,59 @@ class OpProtoAndCheckerMaker {
2626
virtual void Make() = 0;
2727

2828
virtual ~OpProtoAndCheckerMaker() {
29-
PADDLE_ENFORCE(validated_, "should call Validate after build");
29+
CHECK(validated_) << "should call Validate after build";
3030
}
3131

32-
void SetProto(proto::OpProto* proto) { proto_ = proto; }
32+
void SetProto(proto::OpProto *proto) { proto_ = proto; }
3333

34-
void SetChecker(OpAttrChecker* attr_checker) { op_checker_ = attr_checker; }
34+
void SetChecker(OpAttrChecker *attr_checker) { op_checker_ = attr_checker; }
3535

3636
void Validate();
3737

3838
protected:
3939
struct VariableBuilder {
40-
proto::OpProto::Var* var_;
40+
proto::OpProto::Var *var_;
4141

42-
VariableBuilder& AsDuplicable() {
42+
VariableBuilder &AsDuplicable() {
4343
var_->set_duplicable(true);
4444
return *this;
4545
}
4646

47-
VariableBuilder& AsIntermediate() {
47+
VariableBuilder &AsIntermediate() {
4848
var_->set_intermediate(true);
4949
return *this;
5050
}
5151

52-
VariableBuilder& AsDispensable() {
52+
VariableBuilder &AsDispensable() {
5353
var_->set_dispensable(true);
5454
return *this;
5555
}
5656
};
5757

58-
VariableBuilder AddInput(const std::string& name, const std::string& comment);
58+
VariableBuilder AddInput(const std::string &name, const std::string &comment);
5959

60-
VariableBuilder AddOutput(const std::string& name,
61-
const std::string& comment);
60+
VariableBuilder AddOutput(const std::string &name,
61+
const std::string &comment);
6262

6363
template <typename T>
64-
TypedAttrChecker<T>& AddAttr(const std::string& name,
65-
const std::string& comment,
64+
TypedAttrChecker<T> &AddAttr(const std::string &name,
65+
const std::string &comment,
6666
bool generated = false) {
67-
auto* attr = proto_->add_attrs();
67+
auto *attr = proto_->add_attrs();
6868
attr->set_name(name);
6969
attr->set_comment(comment);
7070
attr->set_generated(generated);
7171
attr->set_type(AttrTypeID<T>());
7272
return op_checker_->AddAttrChecker<T>(name);
7373
}
7474

75-
void AddComment(const std::string& comment) { proto_->set_comment(comment); }
75+
void AddComment(const std::string &comment) { proto_->set_comment(comment); }
7676

7777
private:
7878
void CheckNoDuplicatedInOutAttrs();
7979

80-
proto::OpProto* proto_;
81-
OpAttrChecker* op_checker_;
80+
proto::OpProto *proto_;
81+
OpAttrChecker *op_checker_;
8282
bool validated_{false};
8383
};
8484
} // namespace framework

0 commit comments

Comments
 (0)