未验证 提交 64b4aaba 编写于 作者: D duanyanhui 提交者: GitHub

add npu to device_guard (#52774)

上级 6d231b02
...@@ -7449,7 +7449,7 @@ def device_guard(device=None): ...@@ -7449,7 +7449,7 @@ def device_guard(device=None):
device, index = device.split(':') device, index = device.split(':')
if device == 'cpu': if device == 'cpu':
raise ValueError("Should not set device id for cpu.") raise ValueError("Should not set device id for cpu.")
if device not in ['cpu', 'gpu', 'xpu', '', None]: if device not in ['cpu', 'gpu', 'xpu', 'npu', '', None]:
raise ValueError( raise ValueError(
"The Attr(device) should be 'cpu' 'npu' or 'gpu', and it can also be empty string or None " "The Attr(device) should be 'cpu' 'npu' or 'gpu', and it can also be empty string or None "
"when there is no need to specify device. But received %s" % device "when there is no need to specify device. But received %s" % device
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册