Vector similarity and distance functions mirroring sentence_transformers.util.
Summary
Functions
Computes the cosine similarity matrix between two 1D or 2D tensors.
Computes the dot product similarity matrix between two 1D or 2D tensors.
Computes the Euclidean similarity matrix between two tensors.
Returns negative Euclidean distance -dist(a[i], b[j]) so higher values indicate closer vectors.
Computes the Manhattan (L1) similarity matrix between two tensors.
Returns negative Manhattan distance -dist(a[i], b[j]) so higher values indicate closer vectors.
Computes the absolute normalized angle distance between pairs of tensors x[i] and y[i].
Computes the pairwise cosine similarity cos_sim(a[i], b[i]).
Computes the pairwise dot product dot_score(a[i], b[i]).
Computes the pairwise Euclidean similarity -dist(a[i], b[i]).
Computes the pairwise Manhattan similarity -dist(a[i], b[i]).
Functions
Computes the cosine similarity matrix between two 1D or 2D tensors.
Returns a matrix of shape {num_a, num_b} where result[i, j] is the cosine
similarity between a[i] and b[j].
Computes the dot product similarity matrix between two 1D or 2D tensors.
Returns a matrix of shape {num_a, num_b} where result[i, j] is the dot
product between a[i] and b[j].
Computes the Euclidean similarity matrix between two tensors.
Returns negative Euclidean distance -dist(a[i], b[j]) so higher values indicate closer vectors.
Computes the Manhattan (L1) similarity matrix between two tensors.
Returns negative Manhattan distance -dist(a[i], b[j]) so higher values indicate closer vectors.
Computes the absolute normalized angle distance between pairs of tensors x[i] and y[i].
Matches sentence_transformers.util.pairwise_angle_sim.
Computes the pairwise cosine similarity cos_sim(a[i], b[i]).
Computes the pairwise dot product dot_score(a[i], b[i]).
Computes the pairwise Euclidean similarity -dist(a[i], b[i]).
Computes the pairwise Manhattan similarity -dist(a[i], b[i]).