其他分享
首页 > 其他分享> > torch.einsum()

torch.einsum()

作者:互联网

讲解
对比学习论文中出现:

# compute logits
# Einstein sum is more intuitive
# positive logits: Nx1
l_pos = torch.einsum('nc,nc->n', [q, k]).unsqueeze(-1)
# negative logits: NxK
l_neg = torch.einsum('nc,ck->nk', [q, self.queue.clone().detach()])

标签:ck,unsqueeze,einsum,torch,nc,logits
来源: https://www.cnblogs.com/zzai/p/15924824.html