From 1da6f2e399d0ee5372a4afc9b6d3830dd4a44401 Mon Sep 17 00:00:00 2001 From: wanghuancoder Date: Fri, 2 Dec 2022 07:59:26 +0800 Subject: [PATCH] adam batxx_pow not in cpu (#48626) --- python/paddle/optimizer/optimizer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/paddle/optimizer/optimizer.py b/python/paddle/optimizer/optimizer.py index 764c01736a3..52caf92cd60 100644 --- a/python/paddle/optimizer/optimizer.py +++ b/python/paddle/optimizer/optimizer.py @@ -728,8 +728,10 @@ class Optimizer: if device is None: device = self._get_device_for_param(param.name) - if in_dygraph_mode() and ( - device == 'cpu' or isinstance(device, core.CPUPlace) + if ( + in_dygraph_mode() + and (device == 'cpu' or isinstance(device, core.CPUPlace)) + and (not core.is_compiled_with_xpu()) ): _C_ops.full_( var, -- GitLab