OANet
OANet copied to clipboard
About the calculation of the distance matrix in class "NNMatcher"
I understand that variables d1
and d2
are the sum of squares of each descriptor
But I don't know why the distance matrix in NNMatcher.run
is calculated like this
d1, d2 = (desc1**2).sum(1), (desc2**2).sum(1)
distmat = (d1.unsqueeze(1) + d2.unsqueeze(0) - 2*torch.matmul(desc1, desc2.transpose(0,1))).sqrt()
Especially the part - 2*torch.matmul(desc1, desc2.transpose(0,1))
is confusing me
Anybody knows how it works?