已关闭
[Bug]: torch.accelerator.random APIs (initial_seed, get_rng_state, get_rng_state_all) does not work on NPU #3809
dwoai22创建于 8月6日关闭于 22 天前
8月6日 关联了看板:FrameworkPTAdapter 版本issue看板
8月6日 添加了label:bug
8月7日 关联了pull request:fix: fix getDefaultGenerator in NPUHooksInterface.h so that torch.accelerator.random APIs can use NPU backend
8月7日 关联了pull request:fix: fix getDefaultGenerator in NPUHooksInterface.h so that torch.accelerator.random APIs can use NPU backend
8月7日 添加了label:bot-triaged
TorchNPU-Bot
8月7日 评论:
8月7日 评论:
检测到当前 issue 已关联 PR,自动添加标签:bot-triaged


22 天前 关闭了 issue
22 天前 添加了label:resolved
欢迎加入社区,感谢您对社区的贡献 🎉!
欢迎加入社区,感谢您对社区的贡献 🎉!
环境信息
OS: Ubuntu 22.04.5 LTS (Jammy Jellyfish)
Hardware: 1x910B3
CANN: 9.0.0
python: 3.12.13
torch: 2.14.0a0+git97f01c2
torch_npu: 2.14.0+gite229e99
🐛 问题描述
Upstream torch serves 3 APIs in torch.accelerator namespace currently. When these APIs are used
an error is observed.
Reproduction and Error Log
Expected Behaviour
Root Cause
const at::Generator& getDefaultGenerator(c10::DeviceIndex device_index) {
getDefaultGeneratoroftorch_npu/csrc/core/npu/NPUHooksInterface.hcannot override the method inaten/src/ATen/detail/PrivateUse1HooksInterface.hbecause signatures dont match. NPU's getDefaultGenerator lacks trailingconstexpression.Another problem is, returned generator is cached like this:
static auto device_gen = .... When other device indexes given, they will get the generator of the first device that is cached.欢迎加入社区,感谢您对社区的贡献 🎉!
欢迎加入社区,感谢您对社区的贡献 🎉!