Layers.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:DeepCellSeg 作者: arbellea 项目源码 文件源码
def batch_norm(in_tensor, phase_train, name, reuse=None, data_format='NHWC', center=True, scale=True):
    """
    Batch normalization on convolutional maps.
    Ref.: http://stackoverflow.com/questions/33949786/how-could-i-use-batch-normalization-in-tensorflow
    Args:
        x:           Tensor, 4D BHWD input maps
        n_out:       integer, depth of input maps
        phase_train: boolean tf.Varialbe, true indicates training phase
        scope:       string, variable scope
    Return:
        normed:      batch-normalized maps
    """
    axis = -1 if data_format == 'NHWC' else 1
    with tf.variable_scope(name):
        # return tf.contrib.layers.batch_norm(in_tensor, is_training=phase_train, scope=scope, reuse=reuse)
        return tf.layers.batch_normalization(in_tensor, axis=axis, center=center, scale=scale, training=phase_train,
                                             reuse=reuse, fused=True, momentum=0.99)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号