Skip to content

Commit a7c6bf7

Browse files
committed
Change do_model_average_for_mean_and_var to boolean in batch_normal.
1 parent 2e40660 commit a7c6bf7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

python/paddle/fluid/layers/nn.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,9 +1518,6 @@ def batch_norm(input,
15181518
bias = helper.create_parameter(
15191519
attr=helper.bias_attr, shape=param_shape, dtype=dtype, is_bias=True)
15201520

1521-
if do_model_average_for_mean_and_var:
1522-
do_model_average_for_mean_and_var = None
1523-
15241521
mean = helper.create_parameter(
15251522
attr=ParamAttr(
15261523
name=moving_mean_name,

python/paddle/fluid/optimizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,8 @@ def __init__(self,
853853
self.params_grads = [] if params_grads is None else params_grads
854854
params = {}
855855
for param, grad in self.params_grads:
856-
params[param.name] = (param, grad)
856+
if param.do_model_average != False:
857+
params[param.name] = (param, grad)
857858
for param in framework.default_main_program().global_block(
858859
).all_parameters():
859860
if param.name not in params and param.do_model_average != False:

0 commit comments

Comments
 (0)