similarities.py 文件源码

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

项目:jack 作者: uclmr 项目源码 文件源码
def negative_square_l2_distance(x1, x2, axis=1):
    """
    Negative Square L2 Distance.

    .. math:: L = - \\sum_i (x1_i - x2_i)^2

    Args:
        x1: First term.
        x2: Second term.
        axis: Reduction Indices.

    Returns:
        Similarity Value.
    """
    distance = tf.reduce_sum(tf.square(x1 - x2), axis=axis)
    return - distance
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号