Skip to content

[Accuracy diff No. 110, 111] Fix accuracy diff for paddle.nn.functional.binary_cross_entropy, paddle.nn.functional.binary_cross_entropy_with_logits API #267

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

Closed
wants to merge 4 commits into from

Conversation

NKNaN
Copy link
Contributor

@NKNaN NKNaN commented Jun 15, 2025

目前 paddle.nn.functional.binary_cross_entropy, paddle.nn.functional.binary_cross_entropy_with_logits 对应的反向算子只计算 x_grad 不计算 label_grad,而 torch 计算 x_grad 和 target_grad (label_grad):
image
image

第一次回测结果:
image

paddle.nn.functional.binary_cross_entropy_with_logits 能全部通过
paddle.nn.functional.binary_cross_entropy 有两个 case 未通过:

paddle.nn.functional.binary_cross_entropy(Tensor([195840, 80],"float16"), Tensor([195840, 80],"float16"), reduction="none", )
paddle.nn.functional.binary_cross_entropy(Tensor([87040, 80],"float16"), Tensor([87040, 80],"float16"), reduction="none", )

对这两个 case 二次回测结果:
image

Copy link
Collaborator

@cangtianhuang cangtianhuang left a comment

Choose a reason for hiding this comment

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

如果修改可以全部 pass 的话,请将所有会报 [not compare] 错误的配置,从:tester/api_config/5_accuracy/accuracy_7.txt 移动至 tester/api_config/5_accuracy/accuracy_gpu_error_grads_diff.txt,便于后续复测以及修复~

@NKNaN
Copy link
Contributor Author

NKNaN commented Jun 16, 2025

如果修改可以全部 pass 的话,请将所有会报 [not compare] 错误的配置,从:tester/api_config/5_accuracy/accuracy_7.txt 移动至 tester/api_config/5_accuracy/accuracy_gpu_error_grads_diff.txt,便于后续复测以及修复~

好的

@cangtianhuang
Copy link
Collaborator

@NKNaN 以及 tester/api_config/5_accuracy/accuracy_gpu_error.txt 中的所有 [not compare] 出错配置,也复制一份到 tester/api_config/5_accuracy/accuracy_gpu_error_grads_diff.txt 中,保留原有的便于复测 ,辛苦同学

@NKNaN
Copy link
Contributor Author

NKNaN commented Jun 16, 2025

好的,tester/api_config/5_accuracy/accuracy_gpu_error.txt 中的所有 [not compare] 出错配置 是 15857 个,在上面回测通过;tester/api_config/5_accuracy/accuracy_7.txt 是 602 个,回测全部通过:
image

@cangtianhuang
Copy link
Collaborator

不好意思同学,是我描述有点问题,最终应该这样处理:

  • accuracy_7.txt 在修复前能正常 pass,我们就不管它
  • accuracy_gpu_error.txt 修复好的配置 复制 一份到 accuracy_gpu_error_grads_diff.txt 中,保留原有的😊

@NKNaN
Copy link
Contributor Author

NKNaN commented Jun 16, 2025

感谢!
accuracy_7.txt 的 602 个在修复前可以正常pass
image

@NKNaN
Copy link
Contributor Author

NKNaN commented Jun 16, 2025

我 reset 一下

@cangtianhuang
Copy link
Collaborator

我 revert 一下

好滴,看上去误删了很多,这个应该是 git 索引的问题,文件偏大就会有这个问题😂

@NKNaN
Copy link
Contributor Author

NKNaN commented Jun 16, 2025

我 revert 一下

好滴,看上去误删了很多,这个应该是 git 索引的问题,文件偏大就会有这个问题😂

重新提了一个 pr

@cangtianhuang
Copy link
Collaborator

this pr can be closed safely

@NKNaN NKNaN closed this Jun 16, 2025
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