Merged
test(data): adapt torch.utils.data tests on NPU #37378
yulin520Add on Jun 1
test(data): adapt torch.utils.data tests on NPU #37378
Merged
Pull Request has been successfully merged by ascend-robot.
(Thank you for yulin520's contribution.)Jun 1 Associated issue: [Usage]: API一致性说明:torch.utils.data 相关 API 验证及部分资料缺失
ascend-robot
Jun 1 Comments:
Jun 1 Comments:
Jun 1 Added label: ascend-cla/yes
ascend-robot
Jun 1 Comments:
Jun 1 Comments:
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 |
|---|---|---|
| test_upstream | ✅ 李伟, sunyu-xuan (2/2) | ✅ 李伟 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
weixin_65332823, thanks for your pull request. All authors of the commits have signed the CLA. 👍


63 messages are collapsed here。 See more
sunyu-xuan
Jun 8 Comments:
Jun 8 Comments:
/lgtm


Jun 8 Added label: approvedlgtm
Jun 8 Merged pull request
ascend-robot
Jun 8 Comments:
Jun 8 Comments:
流水线 pytorch_gitcode_PR_multiVersion#10215 [ commitID:67cd63d8 ] 已完成


关联 Issue
修改内容
本 PR 对
torch.utils.data相关社区用例进行 NPU 适配。修改文件:
test_upstream/test/test_dataloader.py.patchtest_upstream/test/test_datapipe.py.patch主要修改:
对相关测试用例中的 Tensor 显式迁移至 NPU;
在测试文件中引入:
import torch_npu from torch_npu.contrib import transfer_to_npu对
TestDataLoader.test_multiprocessing_contexts增加 NPU IPC 条件判断。当未启用expandable_segments:True时跳过该用例,避免 DataLoader worker 间 NPU Tensor 共享场景异常。验证环境
验证命令
验证结果
OK;其中test_multiprocessing_contexts在未启用expandable_segments:True时按预期跳过;OK;OK。保留原始语义用例
Patch 生成与检查说明
本 PR 中的 patch 基于对应版本的 PyTorch 社区源码生成。已有 patch 时,先应用原 patch,再修改社区源码,最后通过
git diff重新生成 patch 文件。未手动编辑 patch 文件。已执行:
检查结果通过。
补充对应版本的用例执行结果和耗时截图
目标分支:v2.10.0
已在匹配版本的PyTorch和torch_npu运行时环境中完成以下验证:
DataLoader相关用例
DataPipe相关用例
原始语义回归用例
以上用例均已执行通过。
其中,test_multiprocessing_contexts在未启用expandable_segments:True时按预期跳过。
详细测试数量和执行耗时见附件截图。
