| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
test_functorch Co-authored-by: SCh_zx<1325467101@qq.com> # message auto-generated for no-merge-commit merge: !38899 merge master into master test_functorch Created-by: SCh_zx Commit-by: SCh_zx Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20260203 --> # 【合入来源】 > <font color="red">**如有社区issue,请关联issue链接**</font>\ > <font color="red">**请勿携带内部流程信息(需求链接、问题单、内部issue等)**</font> - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 # 【修改方案】 > 请描述修改内容的具体实现,涉及哪些组件之间进行交互,可以用1、2、3、...进行罗列\ > 如果是需求或者重构类的PR,需要补充详细设计文档(说明上下游组件关系、时序图、类图、DFX能力等内容) functorch用例问题,阻塞合入,先行跳过,issue跟踪 # 【资料变更】 > 请确认是否涉及资料变更。如涉及,需要在PR中体现,并简要说明修改内容。如不涉及,需填写“不涉及” # 【接口变更】 > 请确认是否涉及跨代码仓或者客户面可见的接口变更。如涉及,需要详细说明接口以及对应的变更内容,同时需要在资料中体现。如不涉及,需填写“不涉及” # 【功能验证】 > 说明测试场景,测试方法。如果本次测试方式与常规单元测试不同,请详细说明您的测试步骤\ > 新增/变更内容是否已新增/适配UT测试用例看护,并补充测试自验证截图 # 【CheckList】 > PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x] - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!38899 | 3 个月前 | |
test: add validation cases for tree_flatten, tree_unflatten and active_fake_mode APIs Co-authored-by: liuhaodong-2026<liuhaodong@isrc.iscas.ac.cn> # message auto-generated for no-merge-commit merge: !40725 merge test-vmap-pytree-guards-master into master test: add validation cases for tree_flatten, tree_unflatten and active_fake_mode APIs Created-by: liuhaodong-2026 Commit-by: liuhaodong-2026 Merged-by: ascend-robot Description: # 【合入来源】 - [ ] 需求 - [ ] 问题单 - [x] issue/工单 - [ ] 重构优化 - [ ] 资料更新 关联 issue: - https://gitcode.com/Ascend/pytorch/issues/2693 - https://gitcode.com/Ascend/pytorch/issues/2694 - https://gitcode.com/Ascend/pytorch/issues/2695 # 【修改方案】 1. 新增测试文件 test/functorch/test_vmap_pytree_apis.py,为 torch._functorch.vmap.tree_flatten 和 torch._functorch.vmap.tree_unflatten 补充用例,覆盖 list、dict、嵌套结构、tensor 的 flatten/unflatten 及 roundtrip 场景。 2. 新增测试文件 test/fx/test_guards_apis.py,为 torch._guards.active_fake_mode 补充用例,覆盖 FakeTensorMode 上下文内外、嵌套上下文等场景。 3. PyTorch 官方社区暂无针对以上三个 API 的直接用例覆盖(tree_flatten/tree_unflatten 社区用例均通过 torch.utils._pytree 导入验证,未直接验证 torch._functorch.vmap 下的别名;active_fake_mode 无社区用例),因此自行编写用例并提交到 test 目录。 4. 三个 API 均为纯 Python 实现(tree_flatten/tree_unflatten 是 torch.utils._pytree 的别名,active_fake_mode 为 torch._guards 模块内的上下文查询函数),不涉及 NPU 适配,不需要代码修改。 # 【资料变更】 不涉及。以上三个 API 均为 PyTorch 私有接口(torch._functorch、torch._guards),按规范私有接口不需要补充资料。 # 【接口变更】 不涉及。 # 【功能验证】 1. 测试方法:本地容器环境执行 pytest,命令如下: TORCH_DEVICE_BACKEND_AUTOLOAD=0 python3 -m pytest test/functorch/test_vmap_pytree_apis.py test/fx/test_guards_apis.py -v 2. 新增用例共 13 个(test_vmap_pytree_apis.py 8 个,test_guards_apis.py 5 个),已在 v2.7.1、v2.9.0、v2.10.0、v2.11.0、v2.12.0、master 六个版本全部验证通过(13 passed)。 3. 涉及张量创建的用例已适配 NPU 设备(通过 torch.accelerator.current_accelerator() 获取设备并迁移张量)。 4. 测试自验证截图: # 【测试用例设计说明】 1. test_tree_flatten_list:验证 tree_flatten 对列表结构的展开 2. test_tree_flatten_dict:验证 tree_flatten 对字典结构的展开 3. test_tree_flatten_nested:验证对嵌套结构的展开 4. test_tree_flatten_with_tensor:验证包含张量时的展开 5. test_tree_unflatten_list:验证 tree_unflatten 对列表的还原 6. test_tree_unflatten_dict:验证 tree_unflatten 对字典的还原 7. test_tree_flatten_unflatten_roundtrip:验证嵌套结构的完整往返 8. test_tree_flatten_unflatten_roundtrip_with_tensors:验证含张量的完整往返 test_active_fake_mode_returns_none_outside_context test_active_fake_mode_returns_mode_inside_context test_active_fake_mode_returns_none_after_context_exits test_active_fake_mode_nested_context test_active_fake_mode_with_fake_tensor # 【CheckList】 - [x] 代码注释完备,正确记录错误日志 - [x] 代码实现进行了返回值、空指针等校验 - [x] PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等 - [x] PR持续集成流水线(CI)执行通过,代码检查无异常 See merge request: Ascend/pytorch!40725 | 2 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 3 个月前 | ||
| 2 个月前 |