Skip to content

Tolerance added for rff tests #1829

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions test/Microsoft.ML.TestFramework/DataPipe/TestDataPipeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,12 +1164,10 @@ private bool EqualWithEpsDouble(Double x, Double y)
return FloatUtils.GetBits(x) == FloatUtils.GetBits(y) || CompareNumbersWithTolerance(x, y, null, 3);
}

private const float SingleEps = 1e-6f;

private static bool EqualWithEpsSingle(float x, float y)
private bool EqualWithEpsSingle(float x, float y)
{
// bitwise comparison is needed because Abs(Inf-Inf) and Abs(NaN-NaN) are not 0s.
return FloatUtils.GetBits(x) == FloatUtils.GetBits(y) || Math.Abs(x - y) < SingleEps;
return FloatUtils.GetBits(x) == FloatUtils.GetBits(y) || CompareNumbersWithTolerance(x, y, null, 3);
}

protected Func<bool> GetComparerOne<T>(Row r1, Row r2, int col, Func<T, T, bool> fn)
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.ML.Tests/Transformers/RffTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private class TestClassInvalidSchema
public int A;
}

[ConditionalFact(typeof(BaseTestBaseline), nameof(BaseTestBaseline.LessThanNetCore30OrNotNetCore))] // netcore3.0 output differs from Baseline
[Fact]
public void RffWorkout()
{
Random rand = new Random();
Expand Down