Pull Request已成功合入, 合并人@ascend-robot
(感谢 我应该是一阵风 的贡献)Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/pytorch | ✅ liangsongwei, chengpeng25 (2/2) | ✅ liangsongwei (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
Windwindzzz, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Linking Issue Notice
@Windwindzzz , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .


当前仓库存在以下 保护分支 :
| Protected Branch | Version | Release |
|---|---|---|
| master | ||
| v2.12.0 | ||
| v2.7.1 | ||
| v2.7.1-26.1.0 | ||
| v2.11.0 | ||
| v2.10.0 | ||
| v2.9.0 | ||
| v2.9.0-26.1.0 | ||
| v2.12.0-26.1.0 | ||
| v2.11.0-26.1.0 | ||
| v2.10.0-26.1.0 | ||
| ci-test | ||
| sync-pr28113--to-v2.9.0 |
评论 /sync <branch1> <branch2> ... 可将当前 PR 修改同步到其它分支(创建同步 PR):
a) 如果当前 PR 是 Open 状态,同步操作将延迟到 PR 被合并时执行
b) 如果当前 PR 已经 Merged,将立即执行同步操作
注意:
- /sync 命令可以指定同步到多个分支,仅最后一个 /sync 命令生效
- 如果创建的同步 PR 不正确,可通过向同步 PR 的源分支提交轻量级 PR 完善,或使用 /close 命令关闭


Ascend docs pipeline is running...


compile


compile


✅ 跳过 docs ci 检查,没有需要检查的文档文件


Ascend docs pipeline is running...


Ascend docs pipeline is running...


基于对当前代码和 PR 标题的分析,以下是变更摘要:
变更摘要
此 PR 修复了 _copy_from_and_resize 函数中过于严格的 resize 条件。原实现中,resize 触发条件加入了额外的约束(结合 PR 标题"relax"暗示,很可能是在 self.sizes() != dst.sizes() 基础上叠加了 self.numel() 等更严格的校验),导致在某些合法的 size 不匹配场景下未能正确触发 dst.resize_as_(self),进而引发后续 TORCH_CHECK 失败。本次改动将该条件放宽为仅依赖 self.sizes() != dst.sizes() 判断,使 resize 行为与函数名语义保持一致。
主要改动
- 放宽 resize 触发条件:
torch_npu/csrc/aten/ops/CopyFromAndResizeKernelNpu.cpp中第 12 行的if条件被简化为仅检查self.sizes() != dst.sizes(),移除了原先附加的约束(如numel()相等性或其他限制),使得只要源张量与目标张量 shape 不同即触发resize_as_。 - 函数行为与语义对齐:
_copy_from_and_resize的 resize 逻辑现在覆盖了更多合法的 size 不匹配场景,避免了因过于保守的条件导致拷贝失败的问题。


✅ 跳过 docs ci 检查,没有需要检查的文档文件


✅ 跳过 docs ci 检查,没有需要检查的文档文件


| 阶段 | 任务名 | 状态 | 详情 |
|---|---|---|---|
| 编译构建 | Build_X86 | ✅ | >>> |
| Build_ARM | ✅ | >>> | |
| Build_LibTorch_x86 | ✅ | >>> | |
| Build_LibTorch_ARM | ✅ | >>> | |
| Build_X86_torchair | 🛑 | >>> | |
| Build_ARM_torchair | 🛑 | >>> | |
| patch_test | 🛑 | >>> | |
| 恶意代码检查 | Antipoison | ✅ | >>> |
| 编码安全与规范检查 | CodeCheck | ✅ | >>> |
| check_error | ✅ | >>> | |
| CodeCheck_lintrunner | ✅ | >>> | |
| 开源片段检查 | SCA | ✅ | >>> |
| 开发者测试 | UT_X86_Part_01 | 🛑 | >>> |
| UT_X86_Part_02 | 🛑 | >>> | |
| UT_ARM_A3_Part_01 | 🛑 | >>> | |
| UT_ARM_A3_Part_02 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_DIST_ARM_Part_01 | 🛑 | >>> | |
| UT_DIST_ARM_Part_02 | 🛑 | >>> | |
| UT_DIST_ARM_Part_03 | 🛑 | >>> | |
| UT_DIST_ARM_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Select_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Select_Part_02 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |


/lgtm


/approve




【合入来源】
【修改方案】
支持非0tensor的relax _copy_from_and_resize
【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
边缘场景的校验:
【CheckList】