cyclegan.py 文件源码

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

项目:tensorflow-cyclegan 作者: rickbarraza 项目源码 文件源码
def instance_norm(x, name='instance_norm', reuse=False):
    with tf.variable_scope(name, reuse=reuse):
        depth = x.get_shape()[3]
        scale = tf.get_variable('scale', [depth], initializer=tf.random_normal_initializer(1.0, 0.02))
        offset = tf.get_variable('offset', [depth], initializer=tf.constant_initializer(0.0))
        mean, variance = tf.nn.moments(x, axes=[1, 2], keep_dims=True)
        inv = tf.rsqrt(variance + 1e-5)
        normalized = (x - mean) * inv
        return scale * normalized + offset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号