diff --git a/python/paddle/fluid/contrib/mixed_precision/decorator.py b/python/paddle/fluid/contrib/mixed_precision/decorator.py index a4279cde42b5a9f74ca8ab0a52eaa7366f4a4156..37996b6228efe4c2e211b027551bafb4c029d98a 100644 --- a/python/paddle/fluid/contrib/mixed_precision/decorator.py +++ b/python/paddle/fluid/contrib/mixed_precision/decorator.py @@ -66,6 +66,8 @@ class OptimizerWithMixedPrecision(object): self._loss_scaling = None self._init_loss_scaling = init_loss_scaling self._use_dynamic_loss_scaling = use_dynamic_loss_scaling + self._learning_rate = optimizer._learning_rate + self._learning_rate_map = optimizer._learning_rate_map if self._use_dynamic_loss_scaling: self._incr_every_n_steps = incr_every_n_steps self._decr_every_n_nan_or_inf = decr_every_n_nan_or_inf diff --git a/python/paddle/fluid/optimizer.py b/python/paddle/fluid/optimizer.py index d4468f0193b7de1aa706b07cbfcc49cfc5b4478a..684413435c93e38967992703083050e330a9eb65 100644 --- a/python/paddle/fluid/optimizer.py +++ b/python/paddle/fluid/optimizer.py @@ -3751,7 +3751,9 @@ class PipelineOptimizer(object): if framework.in_dygraph_mode(): raise Exception("In dygraph, don't support PipelineOptimizer.") if not isinstance(optimizer, Optimizer) and not isinstance( - optimizer, paddle.optimizer.Optimizer): + optimizer, paddle.optimizer.Optimizer) and not isinstance( + optimizer, paddle.fluid.contrib.mixed_precision.decorator. + OptimizerWithMixedPrecision): raise ValueError("The 'optimizer' parameter for " "PipelineOptimizer must be an instance of " "Optimizer, but the given type is {}.".format(