Skip to content

Conversation

@NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Apr 25, 2024

PR Category

User Experience

PR Types

Improvements

Description

paddle.nn.functional.kl_div 增加参数 log_target
#62986

@paddle-bot
Copy link

paddle-bot bot commented Apr 25, 2024

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Apr 25, 2024
self.log_target = False


class TestKLDivLossOp5(TestKLDivLossOp):
Copy link
Contributor

Choose a reason for hiding this comment

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

log_target为True时,再加一个不同shape的测试case吧

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已增加

self.reduction = 'none'
self.log_target = False

class TestKLDivLossOp5(TestKLDivLossOp):
Copy link
Contributor

Choose a reason for hiding this comment

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

同上

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已增加

if `reduction` is ``'sum'``, the reduced sum loss is returned;
if `reduction` is ``'none'``, no reduction will be applied.
Default is ``'mean'``.
log_target (bool, optional): Indicate whether `label` is passed in log space. Default is False.
Copy link
Contributor

Choose a reason for hiding this comment

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

下面的示例代码,可以加一个log_target=True时的代码

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

if `reduction` is ``'sum'``, the reduced sum loss is returned;
if `reduction` is ``'none'``, no reduction will be applied.
Default is ``'mean'``.
log_target (bool, optional): Indicate whether `label` is passed in log space. Default is False.
Copy link
Contributor

Choose a reason for hiding this comment

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

下面的示例代码,可以加一个log_target=True时的代码

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改

zhwesky2010
zhwesky2010 previously approved these changes Apr 26, 2024
Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhwesky2010
Copy link
Contributor

zhwesky2010 commented Apr 26, 2024

@NKNaN PR-CI-Static-Check显示示例代码有问题,需要再看一下
infoflow 2024-04-26 15-59-53

@NKNaN
Copy link
Contributor Author

NKNaN commented Apr 27, 2024

@NKNaN PR-CI-Static-Check显示示例代码有问题,需要再看一下

已修改

Copy link
Contributor

@zhwesky2010 zhwesky2010 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM for docs

@zhwesky2010 zhwesky2010 merged commit b0c3d94 into PaddlePaddle:develop Apr 28, 2024
@luotao1 luotao1 changed the title 【Hackathon 6th No.29】为 paddle.nn.functional.kl_div 进行功能增强 【Hackathon 6th No.29】为 paddle.nn.functional.kl_div 进行功能增强 -part Apr 28, 2024
iosmers pushed a commit to iosmers/Paddle that referenced this pull request Apr 28, 2024
…le#63860) * udpate kldiv_loss * update xpu * fix xpu test * add docs code example and add test case * fix code example * fix code example * fix code example
runzhech pushed a commit to runzhech/Paddle that referenced this pull request Apr 30, 2024
…le#63860) * udpate kldiv_loss * update xpu * fix xpu test * add docs code example and add test case * fix code example * fix code example * fix code example
runzhech pushed a commit to runzhech/Paddle that referenced this pull request Apr 30, 2024
…le#63860) * udpate kldiv_loss * update xpu * fix xpu test * add docs code example and add test case * fix code example * fix code example * fix code example
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 6, 2024
…le#63860) * udpate kldiv_loss * update xpu * fix xpu test * add docs code example and add test case * fix code example * fix code example * fix code example
hxzd5568 pushed a commit to hxzd5568/Paddle that referenced this pull request May 8, 2024
…le#63860) * udpate kldiv_loss * update xpu * fix xpu test * add docs code example and add test case * fix code example * fix code example * fix code example
co63oc pushed a commit to co63oc/Paddle that referenced this pull request May 10, 2024
…le#63860) * udpate kldiv_loss * update xpu * fix xpu test * add docs code example and add test case * fix code example * fix code example * fix code example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

5 participants