已开启
[Bug]: 【26.2.0众测】Guard Filter 文档 API 名在 26.1.0 中不存在(keep_portable_guards_unsafe / skip_all_guards_unsafe) #5243
tsst创建于 9月29日
9月29日 添加了label:bug
9月29日 添加了label:help-wantedbot-triaged
TorchNPU-Bot
9月29日 评论:
9月29日 评论:
检测到社区任务相关 issue,自动添加标签:help-wanted


29 天前 关联了pull request:【26.1.0众测】TorchNPU 众测任务交付(任务1+任务2)- ander_tsing
在提交新问题之前,请确保您已经在社区中搜索过相关问题,并使用了社区中提供的资源/工具后,仍未找到满意的解决方式。
⚠️ 安全信息提醒:请仔细检查提供的文本内容,确保其不包含敏感数据信息,包括但不限于:
在分享配置信息或代码示例时,请将敏感信息脱敏处理,或使用
<TOKEN>等占位符替代原有内容。环境信息
硬件:Atlas 800T A3(IT22HMDA_2_S,Ascend910_9382,HBM 64GB/芯片)
软件:CANN 9.1.0 + TorchNPU 26.1.0(torch 2.9.0 / torch_npu 2.9.0.post6)
🐛 问题描述
现象:
按文档/示例写以下两个 API,运行时报 AttributeError:
本环境实际可用的 GuardFilter 只有 5 个:
python
['keep_tensor_guards_unsafe',
'set_enable_guard_collectives',
'skip_guard_on_all_nn_modules_unsafe',
'skip_guard_on_globals_unsafe',
'skip_guard_on_inbuilt_nn_modules_unsafe']
验证命令:
bash
python3 -c "
import torch.compiler as c
print([n for n in dir(c) if 'guard' in n.lower()])
"
报错日志:
text
AttributeError: module 'torch.compiler' has no attribute 'keep_portable_guards_unsafe'.
Did you mean: 'keep_tensor_guards_unsafe'?
影响:按官方文档/任务书示例写的 gf5、gf6(使用 keep_portable_guards_unsafe / skip_all_guards_unsafe)直接跑不通,需手动替换为最近似 API 才能继续;本环境的 gf5/gf6 已手动替换为 keep_tensor_guards_unsafe / skip_guard_on_all_nn_modules_unsafe 才跑通。文档与实现不一致,新手必踩。
建议:文档补一张“文档 API ↔ 26.1.0 实际 API”对照表,或更新示例到当前版本。


欢迎加入社区,感谢您对社区的贡献 🎉!