-
Notifications
You must be signed in to change notification settings - Fork 5.7k
add some check to operator.run #4544
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
Conversation
paddle/framework/operator.h
Outdated
auto& opKernel = AllOpKernels().at(type_).at( | ||
OpKernelKey(IndicateDataType(ctx), dev_ctx)); | ||
opKernel->Compute(ctx); | ||
PADDLE_ENFORCE_GT(AllOpKernels().count(type_), 0, "op[%s] has no kernel", |
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.
Do not use count
to check contains or not.
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.
use find instead, thanks for pointing out
paddle/framework/operator.h
Outdated
DataType_descriptor(); | ||
std::string data_type_str = | ||
descriptor->FindValueByNumber(data_type)->name(); | ||
PADDLE_THROW("op[%s] has no kernel with data_type[%s]", type_, |
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.
Do not use reflection here. Since #4542
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.
removed
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.
Excellent
fix: #4545