MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / euclidean_distance

Function euclidean_distance

PATH/core/testers/utils/metrics.py:7–13  ·  view source on GitHub ↗
(qf, gf)

Source from the content-addressed store, hash-verified

5
6
7def euclidean_distance(qf, gf):
8 m = qf.shape[0]
9 n = gf.shape[0]
10 dist_mat = torch.pow(qf, 2).sum(dim=1, keepdim=True).expand(m, n) + \
11 torch.pow(gf, 2).sum(dim=1, keepdim=True).expand(n, m).t()
12 dist_mat.addmm_(1, -2, qf, gf.t())
13 return dist_mat.cpu().numpy()
14
15def cosine_similarity(qf, gf):
16 epsilon = 0.00001

Callers 1

computeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected