提交 a7c6bf77 编写于 作者: W wanghaoshuang

Change do_model_average_for_mean_and_var to boolean in batch_normal.

上级 2e40660e
...@@ -1518,9 +1518,6 @@ def batch_norm(input, ...@@ -1518,9 +1518,6 @@ def batch_norm(input,
bias = helper.create_parameter( bias = helper.create_parameter(
attr=helper.bias_attr, shape=param_shape, dtype=dtype, is_bias=True) attr=helper.bias_attr, shape=param_shape, dtype=dtype, is_bias=True)
if do_model_average_for_mean_and_var:
do_model_average_for_mean_and_var = None
mean = helper.create_parameter( mean = helper.create_parameter(
attr=ParamAttr( attr=ParamAttr(
name=moving_mean_name, name=moving_mean_name,
......
...@@ -853,7 +853,8 @@ class ModelAverage(Optimizer): ...@@ -853,7 +853,8 @@ class ModelAverage(Optimizer):
self.params_grads = [] if params_grads is None else params_grads self.params_grads = [] if params_grads is None else params_grads
params = {} params = {}
for param, grad in self.params_grads: for param, grad in self.params_grads:
params[param.name] = (param, grad) if param.do_model_average != False:
params[param.name] = (param, grad)
for param in framework.default_main_program().global_block( for param in framework.default_main_program().global_block(
).all_parameters(): ).all_parameters():
if param.name not in params and param.do_model_average != False: if param.name not in params and param.do_model_average != False:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册