understand_videobased_reid
understand_videobased_reid copied to clipboard
Some puzzled questions about details in realizing triplet loss
# Compute pairwise distance, replace by the official when merged
dist = torch.pow(inputs, 2).sum(dim=1, keepdim=True).expand(n, n)
dist = dist + dist.t()
dist.addmm_(1, -2, inputs, inputs.t())
dist = dist.clamp(min=1e-12).sqrt() # for numerical stability
你好,在损失函数的实现部分,TripletLoss(nn.Module)里面的上述代码我不太理解,能麻烦你解读一下吗? 非常非常感谢。
@swg209 https://www.cnblogs.com/kk17/p/10252440.html