Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Average Model support for 'moving mean' and 'moving variance' of batch_normal op #9459

Merged
merged 8 commits into from
Apr 12, 2018

Conversation

wanghaoshuang
Copy link
Contributor

fix #9458

1. Add attr 'average' into ParamAttr.
2. Make 'params_grads' optional for AverageModel.
3. Add option 'average_mean' and 'average_variance' for batch_normal.
moving_variance_name=None):
moving_variance_name=None,
average_mean=True,
average_variance=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. default by False
  2. average_mean, average_variance -> do_model_average_for_mean_and_var?

They can share the same flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -1137,6 +1137,8 @@ def __init__(self, block, shape, dtype, **kwargs):

self.gradient_clip_attr = kwargs.get('gradient_clip_attr', None)

self.average = kwargs.get('average', True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

average -> do_model_ average ?

The meaning of average is not clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -840,33 +840,45 @@ class ModelAverage(Optimizer):
"""

def __init__(self,
params_grads,
average_window_rate,
average_window_rate=0.15,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not set 0.15 as a default value. 0.15 is not general rate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -28,13 +28,15 @@ def __init__(self,
learning_rate=1.0,
regularizer=None,
trainable=True,
gradient_clip=None):
gradient_clip=None,
average=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avera=True -> do_model_ average=None.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

self.name = name
self.initializer = initializer
self.learning_rate = learning_rate
self.regularizer = regularizer
self.trainable = trainable
self.gradient_clip = gradient_clip
self.average = average
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

average -> model_average

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@wanghaoshuang wanghaoshuang merged commit ef169eb into PaddlePaddle:develop Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Average 'moving mean' and 'moving variance' of batch_normal op
2 participants