-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Polish CompileTime InferShape #4660
Conversation
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
paddle/framework/op_desc.cc
Outdated
for (auto &pair : OperatorWithKernel::AllOpKernels()) { | ||
auto &info = info_map.Get(pair.first); | ||
auto op = | ||
static_cast<OperatorWithKernel *>(info.Creator()("", {}, {}, {})); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
… feature/polish_infer_shape
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
OpDescBind
notOperator
, sinceOpDescBind
is a compile-time concept.faster