docarray.math.distance.tensorflow module#
- docarray.math.distance.tensorflow.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 (Tensor) – np.ndarray with ndim=2
y_mat (Tensor) – np.ndarray with ndim=2
eps (
float
) – a small jitter to avoid divde by zerodevice (
str
) – the computational device for embed_model, can be either cpu or cuda.
- Return type
numpy.ndarray
- Returns
np.ndarray with ndim=2
- docarray.math.distance.tensorflow.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 (Tensor) – tensorflow array with ndim=2
y_mat (Tensor) – tensorflow array with ndim=2
device (
str
) – the computational device for embed_model, can be either cpu or cuda.
- Return type
numpy.ndarray
- Returns
np.ndarray with ndim=2
- docarray.math.distance.tensorflow.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 (Tensor) – tensorflow array with ndim=2
y_mat (Tensor) – tensorflow array with ndim=2
device (
str
) – the computational device for embed_model, can be either cpu or cuda.
- Return type
numpy.ndarray
- Returns
np.ndarray with ndim=2