bn值的计算方法
导读:bn值的计算方法?BN的过程,具体是怎样计算均值和方差的?下来找到部分相关代码如下:(\tensorflow\python\layers\normalization.py def call(self, inputs, training=Fa...
bn值的计算方法?
BN的过程,具体是怎样计算均值和方差的?
下来找到部分相关代码如下:(\tensorflow\python\layers\normalization.py)
def call(self, inputs, training=False):
# First, compute the axes along which to reduce the mean / variance,
# as well as the broadcast shape to be used for all parameters.
input_shape = inputs.get_shape()
ndim = len(input_shape)
reduction_axes = list(range(len(input_shape)))
del reduction_axes[self.axis]
broadcast_shape = [1] * len(input_shape)
broadcast_shape[self.axis] = input_shape[self.axis].value
# Determines whether broadcasting is needed.
needs_broadcasting = (sorted(reduction_axes) != list(range(ndim))[:-1])
scale, offset = self.gamma, self.beta
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: bn值的计算方法
本文地址: https://pptw.com/jishu/60872.html