docarray.math.distance.paddle module#
- docarray.math.distance.paddle.cosine(x_mat, y_mat, eps=1e-07, device='cpu')[source]#
Cosine distance between each row in x_mat and each row in y_mat.
- Parameters:
x_mat – np.ndarray with ndim=2
y_mat – np.ndarray with ndim=2
eps – a small jitter to avoid divde by zero
device – the computational device for embed_model, can be either cpu or cuda.
- Returns:
np.ndarray with ndim=2
- docarray.math.distance.paddle.sqeuclidean(x_mat, y_mat, device='cpu')[source]#
Squared euclidean distance between each row in x_mat and each row in y_mat.
- Parameters:
x_mat – paddle array with ndim=2
y_mat – paddle array with ndim=2
device – the computational device for embed_model, can be either cpu or cuda.
- Returns:
np.ndarray with ndim=2
- docarray.math.distance.paddle.euclidean(x_mat, y_mat, device='cpu')[source]#
Euclidean distance between each row in x_mat and each row in y_mat.
- Parameters:
x_mat – paddle array with ndim=2
y_mat – paddle array with ndim=2
device – the computational device for embed_model, can be either cpu or cuda.
- Returns:
np.ndarray with ndim=2