Skip to content

Commit

Permalink
more gradient optimizer tests
Browse files Browse the repository at this point in the history
fix evaluate

Not needed assert removed# This is a combination of 3 commits.

more gradient optimizer tests

fix evaluate

Not needed assert removed
  • Loading branch information
novikov-alexander committed Nov 13, 2023
1 parent b617d89 commit 9308d67
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions test/Tensorflow.UnitTest/PythonTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,27 +211,6 @@ public int Compare(object? x, object? y)
var givenAsDouble = given.Select(x => Convert.ToDouble(x)).ToArray();
CollectionAssert.AreEqual(expected, givenAsDouble, new CollectionComparer(eps));
}

public void assertAllCloseAccordingToType<T>(
double value,
NDArray array2,
double eps = 1e-5) where T : struct
{
// TODO: check if any of arguments is not double and change toletance
// remove array2AsDouble and cast expected instead
var givenAsDouble = array2.Select(x => { double v = x; return v; }).ToArray();

if (array2.shape.IsScalar)
{
double value2 = array2;
Assert.AreEqual(value, value2, eps);
return;
}
var array1 = np.ones_like(array2) * value;
CollectionAssert.AreEqual(array1.ToArray(), array2.ToArray(), new CollectionComparer(eps));

//TODO: Assert.IsTrue(np.allclose(array1, array2, rtol: eps));
}

public void assertProtoEquals(object toProto, object o)
{
Expand Down

0 comments on commit 9308d67

Please sign in to comment.