Skip to content
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

[Enh] Avoid multiplication with weight 1 if weight is None #714

Merged
merged 1 commit into from
Dec 22, 2023

Conversation

HydrogenSulfate
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate commented Dec 22, 2023

PR types

Others

PR changes

APIs

Describe

  1. 当 constraint 未指定 weight_dict 时,其构建出的 dataset.__getitem__() 返回的 weight 为空字典,而非全 1 的 ndarray,此时在 loss 计算时可跳过此类冗余的 “乘1” 计算。

Copy link

paddle-bot bot commented Dec 22, 2023

Thanks for your contribution!

@HydrogenSulfate HydrogenSulfate changed the title [Enh] avoid multiplication with weight 1 if weight is None for reducing com… [Enh] avoid multiplication with weight 1 if weight is None Dec 22, 2023
@HydrogenSulfate HydrogenSulfate changed the title [Enh] avoid multiplication with weight 1 if weight is None [Enh] Avoid multiplication with weight 1 if weight is None Dec 22, 2023
Copy link
Collaborator

@zhiminzhang0830 zhiminzhang0830 left a comment

Choose a reason for hiding this comment

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

LGTM

@zhiminzhang0830 zhiminzhang0830 merged commit dafef83 into PaddlePaddle:develop Dec 22, 2023
3 checks passed
@HydrogenSulfate HydrogenSulfate deleted the opt_weight branch December 23, 2023 16:34
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
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