From 64b4aabaa2978b13afad478d54c418ab10702272 Mon Sep 17 00:00:00 2001 From: duanyanhui <45005871+YanhuiDua@users.noreply.github.com> Date: Fri, 14 Apr 2023 13:06:21 +0800 Subject: [PATCH] add npu to device_guard (#52774) --- python/paddle/fluid/framework.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/paddle/fluid/framework.py b/python/paddle/fluid/framework.py index ce69592a07b..136dba59a12 100644 --- a/python/paddle/fluid/framework.py +++ b/python/paddle/fluid/framework.py @@ -7449,7 +7449,7 @@ def device_guard(device=None): device, index = device.split(':') if device == '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( "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 -- GitLab