Skip to content

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

Merged
zhiminzhang0830 merged 1 commit into
PaddlePaddle:developfrom
HydrogenSulfate:opt_weight
Dec 22, 2023
Merged

[Enh] Avoid multiplication with weight 1 if weight is None#714
zhiminzhang0830 merged 1 commit into
PaddlePaddle:developfrom
HydrogenSulfate:opt_weight

Conversation

@HydrogenSulfate
Copy link
Copy Markdown
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” 计算。

@paddle-bot
Copy link
Copy Markdown

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
Copy Markdown
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
@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