Pull Request已成功合入, 合并人@ascend-robot
(感谢 mamba_ni 的贡献)本PR中共发现代码检查告警抑制17处,请Committer检视合理性
本评论自动扫描PR中使用的开源代码检查工具(ruff、clang-tidy、CodeQL等)的屏蔽注释。
这些屏蔽注释会阻止开源代码检查工具对特定代码区域的检测,可能导致潜在问题被忽略。
以下表格展示前10条屏蔽注释,点击下载完整报告
| 文件路径 | 行号 | 屏蔽类型 | 代码片段 | 工具名称 |
|---|---|---|---|---|
| test/npu/test_amp_autocast.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cpu_stream.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_Event.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_current_device.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_default_stream.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_device.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_device_count.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_device_of.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_empty_cache.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_get_rng_state_all.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |


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 | ✅ htchu, wangmin0104 (2/2) | ✅ htchu (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
mamba_ni, thanks for your pull request. All authors of the commits have signed the CLA. 👍


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


Ascend docs pipeline is running...


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


compile


Ascend docs pipeline is running...


✅ 跳过 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_DIST_X86_Part_01 | 🛑 | >>> | |
| UT_DIST_X86_Part_02 | 🛑 | >>> | |
| UT_DIST_X86_Part_03 | 🛑 | >>> | |
| UT_DIST_X86_Part_04 | 🛑 | >>> | |
| UT_inductor_Part_01 | 🛑 | >>> | |
| UT_inductor_Part_02 | 🛑 | >>> | |
| UT_inductor_Part_03 | 🛑 | >>> | |
| UT_inductor_Part_04 | 🛑 | >>> | |
| UT_ARM_A2_Part_01 | ✅ | >>> | |
| UT_ARM_A2_Part_02 | ✅ | >>> | |
| UT_ARM_A2_Part_03 | ✅ | >>> | |
| 流水线 | PR-pipeline_pytorch | ✅ | >>> |


本PR中共发现代码检查告警抑制17处,请Committer检视合理性
本评论自动扫描PR中使用的开源代码检查工具(ruff、clang-tidy、CodeQL等)的屏蔽注释。
这些屏蔽注释会阻止开源代码检查工具对特定代码区域的检测,可能导致潜在问题被忽略。
以下表格展示前10条屏蔽注释,点击下载完整报告
| 文件路径 | 行号 | 屏蔽类型 | 代码片段 | 工具名称 |
|---|---|---|---|---|
| test/npu/test_amp_autocast.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cpu_stream.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_Event.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_current_device.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_default_stream.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_device.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_device_count.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_device_of.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_empty_cache.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |
| test/npu/test_cuda_get_rng_state_all.py | 3 | 行级屏蔽 | 1: # Owner(s): ["module: tests"] 3: import torch_npu # noqa: F401 5: import torch 8: try: 9: from torch_npu.testing.testcase import run_tests, TestCase 10: except ImportError: 11: import sys |
flake8 |


/lgtm


Review Guide
This pull-request passes review.
Committers who wrote a comment of /approve are: htchu.
Reviewers who wrote a comment of /lgtm are: htchu, wangmin0104.


【合入来源】
【修改方案】
补充torch.cuda.get_rng_state_all等17个API的ut用例
【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
不涉及
【CheckList】