Browse Source

minor fixes in NN XOR

tags/v0.9
Meinrad Recheis 6 years ago
parent
commit
1025e5fbce
2 changed files with 5 additions and 4 deletions
  1. +4
    -3
      test/TensorFlowNET.Examples/NeuralNetXor.cs
  2. +1
    -1
      test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs

+ 4
- 3
test/TensorFlowNET.Examples/NeuralNetXor.cs View File

@@ -58,7 +58,8 @@ namespace TensorFlowNET.Examples
// Start tf session // Start tf session
with(tf.Session(graph), sess => with(tf.Session(graph), sess =>
{ {
init.run();
// init.run()
sess.run(init);
var step = 0; var step = 0;
//TODO: make the type conversion and jagged array initializer work with numpy //TODO: make the type conversion and jagged array initializer work with numpy
//var xy = np.array(new bool[,] //var xy = np.array(new bool[,]
@@ -90,9 +91,9 @@ namespace TensorFlowNET.Examples
loss_value = sess.run(loss, new FeedItem(features, xy), new FeedItem(labels, y_)); loss_value = sess.run(loss, new FeedItem(features, xy), new FeedItem(labels, y_));
step++; step++;
if (step%1000==0) if (step%1000==0)
Console.WriteLine($"Step {0} loss: {loss_value[0]}");
Console.WriteLine($"Step {step} loss: {loss_value}");
} }
Console.WriteLine($"Final loss: {loss_value[0]}");
Console.WriteLine($"Final loss: {loss_value}");
}); });
return true; return true;
} }


+ 1
- 1
test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs View File

@@ -109,7 +109,7 @@ namespace TensorFlowNET.ExamplesTests
new TextClassificationWithMovieReviews() { Enabled = true }.Run(); new TextClassificationWithMovieReviews() { Enabled = true }.Run();
} }
[Ignore("Attempting to use uninitialized value Variable_1")]
//[Ignore("Attempting to use uninitialized value Variable_1")]
[TestMethod] [TestMethod]
public void NeuralNetXor() public void NeuralNetXor()
{ {


Loading…
Cancel
Save