-
Notifications
You must be signed in to change notification settings - Fork 78
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
[Fix] l2_exp random fail in half-float32 mixed precision on self-neighboring #596
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
from cuvs.distance import pairwise_distance | ||
|
||
|
||
@pytest.mark.parametrize("times", range(20)) | ||
@pytest.mark.parametrize("n_rows", [50, 100]) | ||
@pytest.mark.parametrize("n_cols", [10, 50]) | ||
@pytest.mark.parametrize( | ||
|
@@ -43,7 +44,7 @@ | |
@pytest.mark.parametrize("inplace", [True, False]) | ||
@pytest.mark.parametrize("order", ["F", "C"]) | ||
@pytest.mark.parametrize("dtype", [np.float32, np.float64, np.float16]) | ||
def test_distance(n_rows, n_cols, inplace, order, metric, dtype): | ||
def test_distance(n_rows, n_cols, inplace, order, metric, dtype, times): | ||
input1 = np.random.random_sample((n_rows, n_cols)) | ||
input1 = np.asarray(input1, order=order).astype(dtype) | ||
|
||
|
@@ -79,7 +80,5 @@ def test_distance(n_rows, n_cols, inplace, order, metric, dtype): | |
actual = output_device.copy_to_host() | ||
|
||
tol = 1e-3 | ||
if np.issubdtype(dtype, np.float16): | ||
tol = 1e-1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I added this reduced tolerance because I was seeing failures - is this no longer needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I tried it successfully at local machines. I think this change can help us block potential actual failures in the future, so I made it. |
||
|
||
assert np.allclose(expected, actual, atol=tol, rtol=tol) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats this times parameter used for? I don't see it used in the test it self -
Are you just trying to run this test multiple times here to stress test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's just for testing multiple times and to guarantee the reproducing on one going because the possibility is close to ~10% empirically.