-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
[phi] move is_empty to phi #39919
[phi] move is_empty to phi #39919
Conversation
Thanks for your contribution! |
paddle/fluid/operators/is_empty_op.h
Outdated
@@ -1,11 +1,8 @@ | |||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. | |||
|
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.
licence里的这些空行是固定格式,不用删,可参考其他文件
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.
Done.
// Note: is_empty is always executed on CPU and the output data should | ||
// always be allocated for CPUPlace. We reigister CUDA kernel for this op to | ||
// avoid the unnecessary data transform. | ||
out->mutable_data<bool>(phi::CPUPlace())[0] = phi::product(x.dims()) == 0; |
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.
这里可以使用dev_ctx.template HostAlloc<T>()
接口替换mutable_data
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.
看注释,这里应该是改为: phi::CPUPlace().HostAlloc() 吧
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.
具体应该怎么改呢,改成下面这样吗
out->mutable_data(phi::CPUPlace().HostAlloc())[0] = phi::product(x.dims()) == 0;
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.
Done.
double, | ||
int, | ||
int64_t) {} | ||
#endif |
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.
这里有个warning,后边可以添加换行
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
PR types
Function optimization
PR changes
OPs
Describe
move is_empty to phi