Skip to content

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

Merged
wanghaoshuang merged 8 commits intoPaddlePaddle:developfrom
wanghaoshuang:fix_avg
Apr 12, 2018
Merged

Make Average Model support for 'moving mean' and 'moving variance' of batch_normal op#9459
wanghaoshuang merged 8 commits intoPaddlePaddle:developfrom
wanghaoshuang:fix_avg

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.


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.

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.

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.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

2 participants