-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
move eye、size、erfinv、pixel_shuffle OP to phi #39712
Conversation
Thanks for your contribution! |
DenseTensor* out) { | ||
auto place = ctx.GetPlace(); | ||
auto out_data = ctx.template Alloc<int64_t>(out); | ||
auto cpu_place = paddle::platform::CPUPlace(); |
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下的命名空间
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.
已修改,感谢
cpu_tensor.Resize(out->dims()); | ||
auto cpu_data = ctx.template HostAlloc<int64_t>(&cpu_tensor); | ||
cpu_data[0] = input.numel(); | ||
paddle::framework::TensorCopy(cpu_tensor, place, out); |
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下的copy_kernel来替换fluid下的TensorCopy
paddle/phi/kernels/cpu/eye_kernel.cc
Outdated
double, | ||
int64_t, | ||
int, | ||
paddle::platform::float16) {} |
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::dtype::float16
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::SizeKernel, | ||
int, | ||
int64_t, | ||
paddle::platform::float16, |
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.
同上
#include "paddle/phi/backends/gpu/gpu_context.h" | ||
#include "paddle/phi/core/kernel_registry.h" | ||
#include "paddle/phi/kernels/impl/pixel_shuffle_grad_kernel_impl.h" | ||
#include "paddle/phi/kernels/pixel_shuffle_grad_kernel.h" |
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.
kernel声明头文件在最前面,可以和其他的宏空行隔开
#include "paddle/phi/backends/gpu/gpu_context.h" | ||
#include "paddle/phi/core/kernel_registry.h" | ||
#include "paddle/phi/kernels/impl/pixel_shuffle_kernel_impl.h" | ||
#include "paddle/phi/kernels/pixel_shuffle_kernel.h" |
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::SizeKernel, | ||
int, | ||
int64_t, | ||
paddle::platform::float16, |
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.
同上,命名空间更新下
auto dx_dims = dx->dims(); | ||
|
||
DenseTensor t; | ||
t.ShareDataWith(*dout); |
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.
这里感觉原来就写的比较trick,现在ShareDataWith其实就是浅拷贝,所以可以改成直接copy一个tensor,例如:DenseTensor t(*dout)
auto o_dims = out->dims(); | ||
|
||
DenseTensor t; | ||
t.ShareDataWith(*in); |
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.
同上
paddle/phi/ops/compat/erfinv_sig.cc
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Unless required by applicable law or agreed to in writing, software |
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.
好像重复了一部分license
paddle/phi/ops/compat/eye_sig.cc
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Unless required by applicable law or agreed to in writing, software |
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.
同上
paddle/phi/ops/compat/size_sig.cc
Outdated
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// Unless required by applicable law or agreed to in writing, software |
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.
同上
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
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
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
Others
PR changes
Others
Describe
调用ForRange需要include fluid