|
|
|
@ -27,7 +27,6 @@ from . import utils
|
|
|
|
|
import random
|
|
|
|
|
from .. import unique_name
|
|
|
|
|
from functools import reduce
|
|
|
|
|
import warnings
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
|
'fc',
|
|
|
|
@ -2048,7 +2047,7 @@ def batch_norm(input,
|
|
|
|
|
param_attr(ParamAttr): The parameter attribute for Parameter `scale`.
|
|
|
|
|
bias_attr(ParamAttr): The parameter attribute for Parameter `bias`.
|
|
|
|
|
data_layout(string, default NCHW): NCHW|NHWC
|
|
|
|
|
in_place(bool, Default False): This argument is deprecated since 0.15.0.
|
|
|
|
|
in_place(bool, Default False): Make the input and output of batch norm reuse memory.
|
|
|
|
|
use_mkldnn(bool, Default false): ${use_mkldnn_comment}
|
|
|
|
|
name(string, Default None): A name for this layer(optional). If set None, the layer
|
|
|
|
|
will be named automatically.
|
|
|
|
@ -2070,10 +2069,6 @@ def batch_norm(input,
|
|
|
|
|
helper = LayerHelper('batch_norm', **locals())
|
|
|
|
|
dtype = helper.input_dtype()
|
|
|
|
|
|
|
|
|
|
if in_place:
|
|
|
|
|
raise warnings.warn("The argument in_place is deprecated since 0.15.0, "
|
|
|
|
|
"please do not set it True.")
|
|
|
|
|
|
|
|
|
|
input_shape = input.shape
|
|
|
|
|
if data_layout == 'NCHW':
|
|
|
|
|
channel_num = input_shape[1]
|
|
|
|
@ -2123,7 +2118,7 @@ def batch_norm(input,
|
|
|
|
|
saved_mean = helper.create_tmp_variable(dtype=dtype, stop_gradient=True)
|
|
|
|
|
saved_variance = helper.create_tmp_variable(dtype=dtype, stop_gradient=True)
|
|
|
|
|
|
|
|
|
|
batch_norm_out = helper.create_tmp_variable(dtype)
|
|
|
|
|
batch_norm_out = input if in_place else helper.create_tmp_variable(dtype)
|
|
|
|
|
|
|
|
|
|
helper.append_op(
|
|
|
|
|
type="batch_norm",
|
|
|
|
|