__init__.py 文件源码

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

项目:confusion 作者: abhimanyudubey 项目源码 文件源码
def PairwiseConfusion(features):
    batch_size = features.size(0)
    if float(batch_size) % 2 != 0:
        raise Exception('Incorrect batch size provided')
    batch_left = features[:int(0.5*batch_size)]
    batch_right = features[int(0.5*batch_size):]
    loss  = torch.norm((batch_left - batch_right).abs(),2, 1).sum() / float(batch_size)

    return loss
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号