Pull Request已成功合入, 合并人@ascend-robot
(感谢 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 |
|---|---|---|
| torch_npu/utils | ✅ liangsongwei, htchu (2/2) | ✅ htchu, liangsongwei (2/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
ascend-ds-bot, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Ascend docs pipeline is running...


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


compile


Ascend docs pipeline is running...


Ascend docs pipeline is running...


✅ 跳过 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 | ✅ | >>> |


根据 PR 标题和文件变更,该同步合并请求来自原始 PR #39043,目的是修复 combine_tensors.py 中的连续性判断逻辑。
变更摘要
此 PR 修复了 torch_npu/utils/combine_tensors.py 中组合张量(combined tensor)有效性校验时对张量**连续性(contiguity)**判断缺失的问题。在 is_combined_tensor_valid 函数中增加了 tensor.is_contiguous() 检查,确保只有内存连续的张量才被判定为有效的组合张量成员,避免了非连续张量因数据指针位置异常而通过校验导致的潜在错误。
主要改动
is_combined_tensor_valid增加连续性校验: 在校验组合张量有效性时,新增对tensor.is_contiguous()的检查。原先仅判断张量数据指针是否落在组合张量的地址范围内,现在同时要求张量必须是内存连续的,否则返回False。npu_combine_tensors输入连续性检查: 在组合张量的输入校验阶段,同样增加了对输入张量是否连续的判断,非连续张量将直接抛出RuntimeError,与有效性校验函数保持一致的连续性约束。


/approve




1. Origin pull request:
https://gitcode.com/Ascend/pytorch/merge_requests/39043
2. Original pull request related issue(s):
https://gitcode.com/Ascend/pytorch/issues/2456
3. Original pull request related commit(s):
Signed-off-by: l1919_snow lixinyu68@huawei.com
Signed-off-by: l1919_snow lixinyu68@huawei.com
格式
Signed-off-by: l1919_snow lixinyu68@huawei.com
格式修改
Signed-off-by: l1919_snow lixinyu68@huawei.com