-
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
add is empty op #5639
add is empty op #5639
Conversation
paddle/operators/is_empty_op.cc
Outdated
IsEmptyOpProtoMaker(framework::OpProto *proto, | ||
framework::OpAttrChecker *op_checker) | ||
: OpProtoAndCheckerMaker(proto, op_checker) { | ||
AddInput("X", "the tensor to check whether is empty"); |
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.
It will be good to adher to the naming convention for operators. https://github.com/PaddlePaddle/Paddle/blob/develop/paddle/operators/name_convention.md
paddle/operators/is_empty_op.cc
Outdated
PADDLE_ENFORCE_NOT_NULL(out); | ||
auto *out_tensor = out->GetMutable<framework::LoDTensor>(); | ||
|
||
out_tensor->Resize(framework::make_ddim(std::vector<int>({1}))); |
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 use
out_tensor->Resize({1});
instead
paddle/operators/is_empty_op.cc
Outdated
IsEmptyOpProtoMaker(framework::OpProto *proto, | ||
framework::OpAttrChecker *op_checker) | ||
: OpProtoAndCheckerMaker(proto, op_checker) { | ||
AddInput(kInput, "the tensor to check whether is empty"); |
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.
Sorry for not being clear last time. I was referring to the Input and the Output comments. We can write this as
AddInput(kInput, "(Tensor) Tensor which is to be checked");
We can do similar for Output.
Sorry for not being clear last time
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.
get
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!
fixes: #5627