Skip to content

[Bug fixes]fix bce error when option pos_weight given #65859

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

Merged
merged 5 commits into from
Jul 23, 2024

Conversation

LielinJiang
Copy link
Contributor

@LielinJiang LielinJiang commented Jul 9, 2024

PR Category

Operator Mechanism

PR Types

Bug fixes

Description

binary_cross_entropy get wrong value when pos_weight option was given. Here is an example:

logit = paddle.to_tensor([-14.913008])
label = paddle.to_tensor([1.0])

output = paddle.nn.functional.binary_cross_entropy_with_logits(logit, label, reduction='none', pos_weight=paddle.to_tensor(3.0))
# we expect to get ouput=44.73, but got 14.913

Copy link

paddle-bot bot commented Jul 9, 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.

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Jul 10, 2024
@PaddlePaddle PaddlePaddle unlocked this conversation Jul 10, 2024
Copy link
Contributor

@DesmonDay DesmonDay left a comment

Choose a reason for hiding this comment

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

LGTM

@LielinJiang LielinJiang merged commit 41a5220 into PaddlePaddle:develop Jul 23, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants