Skip to content

Conversation

@reyoung
Copy link
Collaborator

@reyoung reyoung commented May 8, 2018

Do not use ctor

  • Reduce line of codes.
  • We can use virtual function for Maker now.
  • The implementation does not care what maker holds, it is easier to
    refactor later.

Do not use ctor

* Reduce line of codes.
* We can use virtual function for Maker now.
* The implementation does not care what maker holds, it is easier to
refactor later.
@reyoung reyoung force-pushed the feature/clean_op_maker branch from 095fd3b to 0e78cb6 Compare May 8, 2018 10:16
@reyoung reyoung requested review from chengduoZH and dzhwinter May 11, 2018 02:33

virtual ~OpProtoAndCheckerMaker() {
PADDLE_ENFORCE(validated_, "should call Validate after build");
CHECK(validated_) << "should call Validate after build";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception in desturctor will only crash and cannot be catched. Change here to CHECK


void SetProto(proto::OpProto *proto) { proto_ = proto; }

void SetChecker(OpAttrChecker *attr_checker) { op_checker_ = attr_checker; }
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use constructor to avoid all inherited classes to have a constructor.

Copy link
Contributor

@dzhwinter dzhwinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This replacement looks great.

@reyoung reyoung merged commit 046405e into PaddlePaddle:develop May 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants