| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
fix: lintrunner --all-files --take NEWLINE -a Co-authored-by: huangjingwei<huangjingwei4@huawei.com> # message auto-generated for no-merge-commit merge: !35539 merge code_check_lintrunner into master fix: lintrunner --all-files --take NEWLINE -a Created-by: huangjingwei Commit-by: huangjingwei Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 文件必须以 LF 换行符结尾,不允许 CRLF(DOS 换行),执行: lintrunner --all-files --take NEWLINE -a # 【资料变更】 不涉及 # 【接口变更】 不涉及 # 【功能验证】 不涉及 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!35539 | 3 个月前 | |
| 2 年前 | ||
| 2 年前 | ||
[master] test: add validation cases for torch.autograd.profiler_util.Kernel.index Co-authored-by: m0_66826439<209642452@qq.com> # message auto-generated for no-merge-commit merge: !42087 merge master-test-autograd-profiler-util-kernel-index into master [master] test: add validation cases for torch.autograd.profiler_util.Kernel.index Created-by: m0_66826439 Commit-by: m0_66826439 Merged-by: ascend-robot Description: # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联 issue: #2894(社区任务第二期 - Ascend for PyTorch API 一致性开发) # 【修改方案】 为 torch.autograd.profiler_util.Kernel.index 补齐验证用例(用例补齐场景 1.3)。 Kernel 定义于 torch/autograd/profiler_util.py:Kernel = namedtuple("Kernel", ["name", "device", "duration"])。Kernel.index 是 namedtuple 从 tuple 继承的标准方法,返回值在元组中的位置(name=0, device=1, duration=2),找不到抛出 ValueError。 PyTorch 官方社区 test/ 目录中无 Kernel.index 的直接验证用例(test_autograd.py、test/profiler/test_profiler.py 仅从 profiler_util 导入 EventList/FunctionEvent/FunctionEventAvg/_format_time,未涉及 Kernel.index),故新增 test/autograd/test_profiler_util.py,覆盖: 1. 按 name/device/duration 字段值返回正确索引(0/1/2) 2. start/stop 边界参数生效,越界查找抛出 ValueError 3. 查找不存在值抛出 ValueError 文件按可扩展原则组织,后续 profiler_util 其他 API 可在同一文件补充。该 API 为非计算类纯 Python 方法,不涉及张量,无需 NPU 设备迁移;Kernel 在 torch_npu 中直接复用 torch 实现(torch_npu/contrib/transfer_to_npu.py:16),无需代码补齐。 # 【资料变更】 不涉及。已检查 docs/zh/native_apis/ 下各版本目录(pytorch_2-7-1、pytorch_2-9-0、pytorch_2-10-0、pytorch_2-11-0、pytorch_2-12-0)的 torch-autograd.md,Kernel 及 profiler_util 下其他工具类(EventList、FunctionEvent、Interval 等)均未列入支持度表格;Kernel.index 为非计算类纯 Python 方法,与数据类型无关,PyTorch 官方文档同样未单独列出该 tuple 继承方法,无需补充资料。详见 issue #2894。 # 【接口变更】 不涉及。仅新增测试文件,未修改任何对外接口。 # 【功能验证】 测试环境: text torch: 2.10.0+cpu torch_npu: 2.10.0 CANN: 9.0.0 NPU: Ascend910 测试方法: bash source /usr/local/Ascend/ascend-toolkit/set_env.sh TORCH_DEVICE_BACKEND_AUTOLOAD=1 python3.12 /tmp/test_profiler_util.py -v 测试结果(20t NPU 实机环境): root@a89d9d564fe4:/home# source /usr/local/Ascend/ascend-toolkit/set_env.sh root@a89d9d564fe4:/home# TORCH_DEVICE_BACKEND_AUTOLOAD=1 python3.12 /tmp/test_profiler_util.py -v test_kernel_index_raises_value_error_when_missing (__main__.TestProfilerUtilKernelApi.test_kernel_index_raises_value_error_when_missing) ... ok test_kernel_index_returns_field_position (__main__.TestProfilerUtilKernelApi.test_kernel_index_returns_field_position) ... ok test_kernel_index_with_start_stop_bounds (__main__.TestProfilerUtilKernelApi.test_kernel_index_with_start_stop_bounds) ... ok ---------------------------------------------------------------------- Ran 3 tests in 0.309s OK # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签:test - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!42087 | 1 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 3 个月前 | ||
| 2 年前 | ||
| 2 年前 | ||
| 1 个月前 |