Skip to content

测试修复:完善 copy_、trunc_normal_ 和 scale_ 转换规则 - #716

Merged
feixi139 merged 1 commit into
PFCCLab:mainfrom
feixi139:feat-trunc-normal-compare
Aug 21, 2026
Merged

测试修复:完善 copy_、trunc_normal_ 和 scale_ 转换规则#716
feixi139 merged 1 commit into
PFCCLab:mainfrom
feixi139:feat-trunc-normal-compare

Conversation

@feixi139

Copy link
Copy Markdown
Collaborator

修改内容

  • paddle.Tensor.copy_ 增加 composite rule:shape 相同时使用 torch.copy_,shape 不同时使用 torch.set_,并对齐 Paddle 的 dtype 检查和原地修改语义。
  • paddle.nn.init.trunc_normal_ 增加 PyTorch 转换规则及默认参数。
  • 完善 scale_ 转换规则,支持整数 Tensor 的 scalebias 类型处理。

验证

  • pre-commit 检查通过。
  • Python 编译和 JSON 校验通过。
  • copy_ 转换矩阵测试通过。
  • 12 个 copy_ accuracy case 全部通过。

说明

trunc_normal_ 属于随机初始化 API,Paddle 和 PyTorch 的随机序列不会逐元素完全一致;本次修改主要补齐 API 转换规则和参数处理。

@feixi139
feixi139 merged commit de2cd67 into PFCCLab:main Aug 21, 2026
1 check 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.

1 participant