Skip to content

Commit

Permalink
nl linalg to compute l2 distances (needs checking if equal)
Browse files Browse the repository at this point in the history
  • Loading branch information
iasonth95 committed Jan 28, 2025
1 parent 29fddb3 commit 3f02dfd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ def _get_min_l2_distance(olds: List[np.ndarray], new: np.ndarray) -> float:
:param new: torch.Tensor
:return: Minimal l2 distance
"""
return min([np.dot(old - new, old - new) for old in olds])
#return min([np.dot(old - new, old - new) for old in olds])
return min([np.linalg.norm(old - new) for old in olds])

def _get_distances(self, embeddings: List[torch.Tensor]) -> Tuple[List[float], List[str]]:
"""
Expand Down

0 comments on commit 3f02dfd

Please sign in to comment.