Skip to content
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

【Hackathon No.16】add RFC for RRelu #71

Merged
merged 4 commits into from
Apr 8, 2022

Conversation

thunder95
Copy link
Contributor

增加paddle.nn. RRelu设计文档。

@paddle-bot-old
Copy link

PR格式检查通过,你的PR将接受Paddle专家以及开源社区的review,请及时关注PR动态。
The format inspection passed. Your PR will be reviewed by experts of Paddle and developers from the open-source community. Stay tuned.

else:
negative_slope = (lower + upper) / 2.0
print(negative_slope)
m = paddle.nn.LeakyReLU(negative_slope)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不行吧,LeakyReLU是不是每个单元的梯度独立随机的?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leaky_relu 我看了下资料和Paddle源码,alpha都是常量呢。麻烦老师详细指点下呢? 倒是有那种randomizd leakyrelu。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不好意思,写错了。是RRelu应该每个单元的梯度独立随机吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不好意思,写错了。是RRelu应该每个单元的梯度独立随机吧

嗯 您说的对,RRelu前向和梯度都是单个单元进行的, 上述代码也是假定的某个单独单元计算逻辑,这里表述得或许不太恰当, 老师,您看这里该怎么写? 去掉这部分内容可以吗, 或者只描述测试阶段的?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LeakyReLU是整层梯度都一样的,不是每个单元(元素),所以这样的模拟并不等价

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhiboniu 嗯 您说的对,训练阶段不使用leakyrelu, 改成了组合API,辛苦看下。

# 二、飞桨现状
飞桨目前不支持此功能,但可以基于内置API的方式实现。训练阶段可用paddle.nn.functional.prelu进行模拟,测试阶段可用paddle.nn.functional.leaky_relu模拟。

```python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这部分说明是组合API的方式,下面5实现方案部分是新增OP的方式。这里内容修改一下吧,注意文档一致性。
下面这段组合实现的代码可以作为一段原理说明保留。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhiboniu 已修改

这部分说明是组合API的方式,下面5实现方案部分是新增OP的方式。这里内容修改一下吧,注意文档一致性。 下面这段组合实现的代码可以作为一段原理说明保留。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants