Skip to content

Instantly share code, notes, and snippets.

View sitmo's full-sized avatar

Thijs van den Berg sitmo

View GitHub Profile
@mbsariyildiz
mbsariyildiz / .py
Last active March 8, 2024 20:44
Pairwise Euclidean distance computation of elements in 2 tensors, in TensorFlow.
def pairwise_dist (A, B):
"""
Computes pairwise distances between each elements of A and each elements of B.
Args:
A, [m,d] matrix
B, [n,d] matrix
Returns:
D, [m,n] matrix of pairwise distances