Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish CompileTime InferShape #4660

Merged
merged 4 commits into from
Oct 10, 2017

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Oct 10, 2017

  1. InferShape should be a method for OpDescBind not Operator, since
    OpDescBind is a compile-time concept.
  2. Pre-create operators and store them into a map. Make InferShape
    faster

1. InferShape should be a method for `OpDescBind` not `Operator`, since
  `OpDescBind` is a compile-time concept.
2. Pre-create operators and store them into a map. Make InferShape
   faster
for (auto &pair : OperatorWithKernel::AllOpKernels()) {
auto &info = info_map.Get(pair.first);
auto op =
static_cast<OperatorWithKernel *>(info.Creator()("", {}, {}, {}));
Copy link
Member

Choose a reason for hiding this comment

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

can we directly use the creator with no input/output? we call https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/framework/operator.h#L139 to check if all the input/output is set.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since type is empty, the checks will be ignored.

jacquesqiao
jacquesqiao previously approved these changes Oct 10, 2017
Copy link
Member

@jacquesqiao jacquesqiao left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@jacquesqiao jacquesqiao left a comment

Choose a reason for hiding this comment

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

LGTM!

@reyoung reyoung merged commit 7506e48 into PaddlePaddle:develop Oct 10, 2017
@reyoung reyoung deleted the feature/polish_infer_shape branch October 12, 2017 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants