-
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
reimplement paddle.nn.functional.sigmoid_focal_loss #27748
reimplement paddle.nn.functional.sigmoid_focal_loss #27748
Conversation
Thanks for your contribution! |
4d95fa0
to
3f9512d
Compare
3f9512d
to
5772671
Compare
026bfe3
to
f375ef1
Compare
f375ef1
to
317ee0a
Compare
a26da0e
to
b8d7639
Compare
b8d7639
to
94100a4
Compare
python/paddle/nn/functional/loss.py
Outdated
Args: | ||
logit (Tensor): The input prediction tensor. 2-D tensor with shape: [N, *], | ||
N is batch_size, `*` means number of additional dimensions. The ``logit`` | ||
is usually the output of a convolution layer. Available dtype is float32, float64. |
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.
是否支持多维的tensor的输入了?* 表示额外的维度,* 有可能是一维或者多维的信息
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.
已经去掉2-D tensor的描述。谢谢~
python/paddle/nn/functional/loss.py
Outdated
a 1-D Tensor whose shape is `[1, ]`. The data type is float32, float64. | ||
For object detection task, it is the the number of positive samples. | ||
If set to None, the focal loss will not be normalized. | ||
alpha(int|float): Hyper-parameter to balance the positive and negative example, |
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.
因为有默认值,因此是optional
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.
已加上optional。谢谢~
python/paddle/nn/functional/loss.py
Outdated
If set to None, the focal loss will not be normalized. | ||
alpha(int|float): Hyper-parameter to balance the positive and negative example, | ||
it should be between 0 and 1. Default value is set to 0.25. | ||
gamma(int|float): Hyper-parameter to modulate the easy and hard examples. |
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.
已加上,谢谢~
python/paddle/nn/functional/loss.py
Outdated
|
||
import paddle | ||
|
||
paddle.disable_static() |
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.
尝试一下是否可以去掉disable_static,现在默认打开的是动态图
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
PR types
New features
PR changes
OPs
Describe
The paddle.nn.functional.sigmoid_focal_loss is implemented by alias of paddle.fluid.layers.sigmod_focal_loss before, now it is reimplement by composing the sigmoid and binary_cross_entropy_with_logits ops.
chinese pr: PaddlePaddle/docs#2751