Skip to content

Commit e493647

Browse files
committed
tests: added neural net XOR tests and enabled KMeans test which passes
1 parent 0b99f3c commit e493647

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

test/TensorFlowNET.Examples/NeuralNetXor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class NeuralNetXor : Python, IExample
1616
public int Priority => 10;
1717
public bool Enabled { get; set; } = true;
1818
public string Name => "NN XOR";
19-
public bool ImportGraph { get; set; } = false;
19+
public bool ImportGraph { get; set; } = true;
2020

2121
public int num_steps = 5000;
2222

@@ -57,7 +57,7 @@ public bool Run()
5757
else
5858
loss_value=RunWithBuiltGraph();
5959

60-
return loss_value < 0.0627;
60+
return loss_value < 0.0628;
6161
}
6262

6363
private float RunWithImportedGraph()

test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ public void InceptionArchGoogLeNet()
4040
new InceptionArchGoogLeNet() { Enabled = true }.Run();
4141
}
4242

43-
[Ignore]
4443
[TestMethod]
4544
public void KMeansClustering()
4645
{
4746
tf.Graph().as_default();
48-
new KMeansClustering() { Enabled = true, train_size = 500, validation_size = 100, test_size = 100, batch_size =100 }.Run();
47+
new KMeansClustering() { Enabled = true, ImportGraph = true, train_size = 500, validation_size = 100, test_size = 100, batch_size =100 }.Run();
4948
}
5049

5150
[TestMethod]
@@ -109,15 +108,20 @@ public void TextClassificationWithMovieReviews()
109108
new TextClassificationWithMovieReviews() { Enabled = true }.Run();
110109
}
111110

112-
[Ignore("Loss function optimization is not working yet")]
113111
[TestMethod]
114112
public void NeuralNetXor()
115113
{
116114
tf.Graph().as_default();
117-
Assert.IsTrue(new NeuralNetXor() { Enabled = true }.Run());
115+
Assert.IsTrue(new NeuralNetXor() { Enabled = true, ImportGraph = false }.Run());
116+
}
117+
118+
[TestMethod]
119+
public void NeuralNetXor_ImportedGraph()
120+
{
121+
tf.Graph().as_default();
122+
Assert.IsTrue(new NeuralNetXor() { Enabled = true, ImportGraph = true }.Run());
118123
}
119124

120-
121125

122126
}
123127
}

0 commit comments

Comments
 (0)