ops.py 文件源码

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

项目:CycleGAN-TensorFlow 作者: vanhuyz 项目源码 文件源码
def _instance_norm(input):
  """ Instance Normalization
  """
  with tf.variable_scope("instance_norm"):
    depth = input.get_shape()[3]
    scale = _weights("scale", [depth], mean=1.0)
    offset = _biases("offset", [depth])
    mean, variance = tf.nn.moments(input, axes=[1,2], keep_dims=True)
    epsilon = 1e-5
    inv = tf.rsqrt(variance + epsilon)
    normalized = (input-mean)*inv
    return scale*normalized + offset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号