Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the calculation of the distance matrix in class "NNMatcher" #33

Open
WallofWonder opened this issue Jun 7, 2023 · 0 comments
Open

Comments

@WallofWonder
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant