-
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
【Hackathon No.10】AdaptiveLogSoftmaxWithLoss API #41886
Conversation
add asfm v0.5
# Conflicts: # python/paddle/nn/layer/__init__.py # python/paddle/nn/layer/loss.py
你的PR提交成功,感谢你对开源项目的贡献! |
需要在Describe中添加rfc链接和中文文档pr链接,待CI大部分通过后,开启review |
已添加 |
@yingyibiao 已更新~ |
PR格式检查通过,你的PR将接受Paddle专家以及开源社区的review,请及时关注PR动态。 |
需要新增 |
这个api里面需要构造一些对象,且需要保留,所以我觉得做成Layer比较合适,本任务提出的functional api可能不适用,不知您怎么看 |
可以把具体的理由详细说明一下吗?adaptive_log_softmax_with_loss 和 paddle.nn.functional 目录下其他 loss 函数的差异点在哪里呢? |
Sorry to inform you that 53a05e0's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
import paddle.fluid as fluid | ||
import paddle | ||
from .. import functional as F | ||
from .. import Layer, Sequential, LayerList | ||
from paddle.nn.layer import Linear | ||
from paddle.fluid.framework import _varbase_creator | ||
from .. import Layer |
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.
Layer 重复导入
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.
import 包的顺序按照 built-in、third-party、项目内部包这三类区分。
head_output[not_in_shortlist]) | ||
output[not_in_shortlist] = paddle.argmax( | ||
log_prob, axis=1).cast('float32') | ||
return output |
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.
AdaptiveLogSoftmaxWithLoss 这个类的代码&注释和 torch 一摸一样,原则上我们是禁止直接搬运 torch 代码的。
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.
注释里加了pytorch的license,不知是否可以,而且这个代码部分适配paddle做了一点修改
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.
可以借鉴 pytorch 代码,但是不能一大段直接搬运。
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.
好的 我改一下
PR types
New features
PR changes
APIs
Describe
在 Paddle 框架中,新增 AdaptiveLogSoftmaxWithLoss API
RFC:20200322_api_design_for_AdaptiveLogSoftmaxWithLoss.md
文档PR:PaddlePaddle/docs#4650