From 04e9d721a2539296f877249cadc605cfa8455f3e Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Thu, 30 Apr 2020 17:10:08 +0800 Subject: [PATCH] unitize name in optimizer; test=develop (#24008) --- 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 2934ea5f9a..2cede67ce3 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