-
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
【PaddlePaddle Hackathon 2】29、为 Paddle 新增 PixelUnshuffle 组网 API #40728
【PaddlePaddle Hackathon 2】29、为 Paddle 新增 PixelUnshuffle 组网 API #40728
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
983ae4b
to
b28157e
Compare
增加对extra_repr的测试
修正对extra_repr的测试
PR格式检查通过,你的PR将接受Paddle专家以及开源社区的review,请及时关注PR动态。 |
@@ -0,0 +1,130 @@ | |||
/*Copyright (c) 2022 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.
license格式有点问题,参考下其他头文件,增加下缩进和换行
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.
完成
public: | ||
using framework::OperatorWithKernel::OperatorWithKernel; | ||
|
||
void InferShape(framework::InferShapeContext* ctx) const override { |
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.
这个建议放到infermeta/backward.h中哈,其他的还有是因为正在迁移中,历史算子量比较大,我们还在推进中,比如可以参考softmax_op.cc
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.
完成
@@ -0,0 +1,74 @@ | |||
// Copyright (c) 2022 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.
这个文件需要放到kernels/impl目录中哈,命名可以参考impl目录中的文件,然后kernel.cc和kernel.cu分别在cpu和gpu下,kernels根目录下的cc中是设备无关的kernel实现,即这个kernel的实现里,不能有设备相关的函数,而这个kernel里的Transpose是仅支持CPU和GPU的,我们还有XPU以及将来可能有其他设备
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.
完成
namespace phi { | ||
|
||
template <typename T, typename Context> | ||
void PixelUnshuffleGradKernel(const Context& ctx, |
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
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.
完成
@@ -0,0 +1,73 @@ | |||
// Copyright (c) 2022 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.
同上,该Kernel属于仅支持CPU和GPU的实现,并非设备无关的实现,麻烦移到impl中
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.
完成
|
||
namespace phi { | ||
|
||
KernelSignature PixelUnshuffleOpArgumentMapping( |
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.
前向的ArgumentMapping实现和注册建议移除,会自动解析OpMaker的参数生成的
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
@BrilliantYuKaimin 需要拉取下最新分支解决下冲突,解决后就可以准备合入了~ |
e270ab7
完成 |
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 for API docs
PR types
New features
PR changes
APIs
Describe
完成了Issue:#40304
实现了paddle.nn.PixelUnshuffle和paddle.nn.functional.pixel_unshuffle,其行为是将形为[N,C,H,W]重塑成[N,C,H/r,r,W/r,r]的形状,再转置成[N,C,r,r,H/r,W/r]的形状,最后重塑成[N,Crr,H/r,W/r]的形状。
设计文档:PaddlePaddle/community#60
中文文档:PaddlePaddle/docs#4523