mnist.py 文件源码

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

项目:ml_gans 作者: imironhead 项目源码 文件源码
def repelling_regularizer(bottleneck):
    """
    pulling away, repelling regularizer.

    bottleneck:
        the bottlenect layer in the autoencoder.
    """
    s = tf.contrib.layers.flatten(bottleneck)
    n = tf.cast(tf.shape(s)[0], tf.float32)

    sxst = tf.matmul(s, s, transpose_b=True)

    sn = tf.norm(s, 1, axis=1, keep_dims=True)

    snxsnt = tf.matmul(sn, sn, transpose_b=True)

    total = tf.square(sxst / snxsnt)
    total = tf.reduce_sum(total)

    return 0.1 * (total - n) / (n * (n - 1.0))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号