remove addmm warning

pull/224/head
liaoxingyu 2020-07-31 16:32:10 +08:00
parent 5e23ab756d
commit 35794621cc
2 changed files with 2 additions and 2 deletions

View File

@ -53,7 +53,7 @@ class ReidEvaluator(DatasetEvaluator):
xx = torch.pow(query_feat, 2).sum(1, keepdim=True).expand(m, n)
yy = torch.pow(gallery_feat, 2).sum(1, keepdim=True).expand(n, m).t()
dist = xx + yy
dist.addmm_(1, -2, query_feat, gallery_feat.t())
dist.addmm_(query_feat, gallery_feat.t(), beta=1, alpha=-2)
dist = dist.clamp(min=1e-12).sqrt() # for numerical stability
return dist.cpu().numpy()

View File

@ -37,7 +37,7 @@ def euclidean_dist(x, y):
xx = torch.pow(x, 2).sum(1, keepdim=True).expand(m, n)
yy = torch.pow(y, 2).sum(1, keepdim=True).expand(n, m).t()
dist = xx + yy
dist.addmm_(1, -2, x, y.t())
dist.addmm_(x, y.t(), beta=1, alpha=-2)
dist = dist.clamp(min=1e-12).sqrt() # for numerical stability
return dist