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

add some check to operator.run #4544

Merged
merged 4 commits into from
Oct 1, 2017

Conversation

jacquesqiao
Copy link
Member

@jacquesqiao jacquesqiao commented Sep 30, 2017

fix: #4545

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",
Copy link
Collaborator

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.

Copy link
Member Author

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

DataType_descriptor();
std::string data_type_str =
descriptor->FindValueByNumber(data_type)->name();
PADDLE_THROW("op[%s] has no kernel with data_type[%s]", type_,
Copy link
Collaborator

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

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@jacquesqiao jacquesqiao changed the title fix cond_op_test and add some check to operator.run add some check to operator.run Sep 30, 2017
Copy link
Collaborator

@reyoung reyoung left a comment

Choose a reason for hiding this comment

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

Excellent

@jacquesqiao jacquesqiao merged commit 87efa60 into PaddlePaddle:develop Oct 1, 2017
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.

test_cond_op failed
2 participants