diff --git a/python/paddle/optimizer/optimizer.py b/python/paddle/optimizer/optimizer.py index 764c01736a3ab9fceb00ef84d357658ee915daf1..52caf92cd603a107a71cb64493aba676d53a27f5 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,