From 0edeb8387f72f55e20f4f91f431f816115ea6e4a Mon Sep 17 00:00:00 2001 From: Yibing Liu Date: Thu, 29 Aug 2019 09:41:21 +0800 Subject: [PATCH] Fix arg do_model_average in param_attr (#19448) test=release/1.5 --- paddle/fluid/API.spec | 2 +- python/paddle/fluid/param_attr.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index 16c61a0e49b..71396d90260 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -892,7 +892,7 @@ paddle.fluid.LoDTensorArray.append append(self: paddle.fluid.core_avx.LoDTensorA paddle.fluid.CPUPlace.__init__ __init__(self: paddle.fluid.core_avx.CPUPlace) -> None paddle.fluid.CUDAPlace.__init__ __init__(self: paddle.fluid.core_avx.CUDAPlace, arg0: int) -> None paddle.fluid.CUDAPinnedPlace.__init__ __init__(self: paddle.fluid.core_avx.CUDAPinnedPlace) -> None -paddle.fluid.ParamAttr.__init__ (ArgSpec(args=['self', 'name', 'initializer', 'learning_rate', 'regularizer', 'trainable', 'gradient_clip', 'do_model_average'], varargs=None, keywords=None, defaults=(None, None, 1.0, None, True, None, False)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) +paddle.fluid.ParamAttr.__init__ (ArgSpec(args=['self', 'name', 'initializer', 'learning_rate', 'regularizer', 'trainable', 'gradient_clip', 'do_model_average'], varargs=None, keywords=None, defaults=(None, None, 1.0, None, True, None, True)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.WeightNormParamAttr.__init__ (ArgSpec(args=['self', 'dim', 'name', 'initializer', 'learning_rate', 'regularizer', 'trainable', 'gradient_clip', 'do_model_average'], varargs=None, keywords=None, defaults=(None, None, None, 1.0, None, True, None, False)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.DataFeeder.__init__ (ArgSpec(args=['self', 'feed_list', 'place', 'program'], varargs=None, keywords=None, defaults=(None,)), ('document', '6adf97f83acf6453d4a6a4b1070f3754')) paddle.fluid.DataFeeder.decorate_reader (ArgSpec(args=['self', 'reader', 'multi_devices', 'num_places', 'drop_last'], varargs=None, keywords=None, defaults=(None, True)), ('document', 'be47d7e07824b4281da77472846955ac')) diff --git a/python/paddle/fluid/param_attr.py b/python/paddle/fluid/param_attr.py index 1778f4b55e7..9825f29150d 100644 --- a/python/paddle/fluid/param_attr.py +++ b/python/paddle/fluid/param_attr.py @@ -42,8 +42,8 @@ class ParamAttr(object): trainable(bool): Whether this parameter is trainable. Default True. gradient_clip(BaseGradientClipAttr): The method to clip this parameter's gradient. Default None. - do_model_average(bool): Whether this parameter should do model average. - Default False. + do_model_average(bool): Whether this parameter should do model average + when model average is enabled. Default True. Examples: .. code-block:: python @@ -65,14 +65,14 @@ class ParamAttr(object): regularizer=None, trainable=True, gradient_clip=None, - do_model_average=False): + do_model_average=True): self.name = name self.initializer = initializer self.learning_rate = learning_rate self.regularizer = regularizer self.trainable = trainable self.gradient_clip = gradient_clip - self.model_average = do_model_average + self.do_model_average = do_model_average def _set_default_initializer(self, initializer): """ @@ -170,7 +170,7 @@ class ParamAttr(object): 'regularizer': self.regularizer, 'trainable': self.trainable, 'gradient_clip_attr': self.gradient_clip, - 'model_average': self.model_average + 'do_model_average': self.do_model_average } if with_initializer: kwargs['initializer'] = self.initializer -- GitLab