Tensorflow中实现batch_normalization 的主要是两个命令tf.nn.moments() 和 tf.nn.batch_normalization()
tf.nn.moments(x,axes,shift=None,name=None,keep_dims=False)
x: a tensor 输入
axes:array of ints(list似乎也可以)计算means和variance的方向
output: two tensor objects:mean,variance
就算卷积神经网络中的某层的mean和variance:
tf.nn.batch_normalization(x,mean,variance,offset,scale,variance_epsilon,name=None)
x:input tensor
mean,variance: mean tensor and variance tensor
offset: β
scale: γ
output: the normalized,scaled,offset operation