-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Padding Operation #1094
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
Padding Operation #1094
Conversation
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.
主要看了一下PadFunc和PadGradFunc部分。
class PadFunc : public FunctionBase { | ||
public: | ||
void init(const FuncConfig& config) override { | ||
padc0_ = config.get<int>("padc0"); |
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.
padc0_ ~ padw1_还是定义一个结构体比较好,Pad和PadGrad的接口也可以少点参数。
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.
使用了struct。 以后类似的参数,等Tensor比较完善(各种维度、类型都支持以后),用整数tensor写可能更好些。
} | ||
|
||
template <DeviceType Device> | ||
class PadFunc : public FunctionBase { |
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.
需要在这里描述PadFunc实现的功能,包括输入/输出是什么,如何计算的。
在这里描述是因为,Function是被其他人/地方所使用的,需要让别人知道该如何使用这个Function。
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.
已修改~
}; | ||
|
||
template <DeviceType Device> | ||
class PadGradFunc : public FunctionBase { |
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.
已修改~
namespace paddle { | ||
|
||
/** | ||
* @brief response normalization across feature maps |
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.
已修改~
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.
We need a Tensor class for element wise computation, that can reduce arguments in api.
This fixes compatibility with H100 and resolves PaddlePaddle#1094
在写Image Classification的book时,发现一些配置在cifar10数据集上的ResNet使用 Avg-Pooing + Padding替代conv操作作升维连接,顺便实现了Padding这个操作。