Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using expanded distance computations in pylibraft #1759

Merged
merged 8 commits into from
Aug 23, 2023
Merged
6 changes: 3 additions & 3 deletions python/pylibraft/pylibraft/distance/pairwise_distance.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ cdef extern from "raft_runtime/distance/pairwise_distance.hpp" \
float metric_arg) except +

DISTANCE_TYPES = {
"l2": DistanceType.L2SqrtUnexpanded,
"sqeuclidean": DistanceType.L2Unexpanded,
"euclidean": DistanceType.L2SqrtUnexpanded,
"l2": DistanceType.L2SqrtExpanded,
"sqeuclidean": DistanceType.L2Expanded,
"euclidean": DistanceType.L2SqrtExpanded,
"l1": DistanceType.L1,
"cityblock": DistanceType.L1,
"inner_product": DistanceType.InnerProduct,
Expand Down
2 changes: 1 addition & 1 deletion python/pylibraft/pylibraft/test/test_brute_force.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_knn(n_index_rows, n_query_rows, n_cols, k, inplace, metric, dtype):

cpu_ordered = pw_dists[i, expected_indices]
np.testing.assert_allclose(
cpu_ordered[:k], gpu_dists, atol=1e-4, rtol=1e-4
cpu_ordered[:k], gpu_dists, atol=1e-3, rtol=1e-3
)


Expand Down
2 changes: 1 addition & 1 deletion python/pylibraft/pylibraft/test/test_distance.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ def test_distance(n_rows, n_cols, inplace, metric, order, dtype):

actual[actual <= 1e-5] = 0.0

assert np.allclose(expected, actual, rtol=1e-4)
assert np.allclose(expected, actual, rtol=1e-3)
cjnolet marked this conversation as resolved.
Show resolved Hide resolved