Skip to content

[Bug Fix] Fix std when numel eq to 1#102

Merged
lixinqi merged 1 commit intoPaddlePaddle:developfrom
ooooo-create:fix_numel_eq_1
Aug 6, 2025
Merged

[Bug Fix] Fix std when numel eq to 1#102
lixinqi merged 1 commit intoPaddlePaddle:developfrom
ooooo-create:fix_numel_eq_1

Conversation

@ooooo-create
Copy link
Contributor

PR Category

Bug Fix

Description

return torch.randn(size=shape).to(dtype).to(device) * std * 0.2 + mean 中之前 #82 是默认使用了 nan,会产生 nan 的数据,虽然能让模型成功运行得到计算图。现在遇到开启 dynamic=True 的时候 microsoft/mpnet-base ,dropout 中的 p 参数会从 weight_meta 的 Tensor 形式 .item 中得到,这个时候 nan 的值就会报错,p 不期望是 nan. 所以现在改成了 std = 0

@lixinqi lixinqi merged commit b06881a into PaddlePaddle:develop Aug 6, 2025
3 checks passed
@paddle-bot
Copy link

paddle-bot bot commented Aug 6, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Aug 6, 2025
@ooooo-create ooooo-create deleted the fix_numel_eq_1 branch September 29, 2025 09:48
JewelRoam pushed a commit to JewelRoam/GraphNet that referenced this pull request Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contributor External developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants