From 56fd2e478b76bdc8ea88dc63a35fc485e5b5bb94 Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Tue, 21 Apr 2020 12:13:16 +0800 Subject: [PATCH] Pick dygraph use same name with static mode (#24011) * change compare op fore_cpu true to false; test=develop * unitize name in optimizer; test=develop * remove force_cpu; test=develop --- python/paddle/fluid/optimizer.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/python/paddle/fluid/optimizer.py b/python/paddle/fluid/optimizer.py index 2934ea5f9a5..2cede67ce3a 100644 --- a/python/paddle/fluid/optimizer.py +++ b/python/paddle/fluid/optimizer.py @@ -68,16 +68,13 @@ class Optimizer(object): grad_clip=None, name=None): self._parameter_list = parameter_list + self._name = name if framework.in_dygraph_mode(): if not isinstance(learning_rate, float) and \ not isinstance(learning_rate, LearningRateDecay): raise TypeError( "learning rate should be float or LearningRateDecay, got %s here" % type(learning_rate)) - if name is not None: - self._name = unique_name.generate(name) - else: - self._name = unique_name.generate(self.__class__.__name__) if self._parameter_list is None: raise AttributeError( "parameter_list argument given to the Optimizer should not be None in dygraph mode." @@ -96,7 +93,6 @@ class Optimizer(object): raise TypeError( "learning rate should be float or Variable, got %s here" % type(learning_rate)) - self._name = name if grad_clip is not None: if not isinstance(grad_clip, GradientClipBase): -- GitLab