From d86bce0fad2c89bdf784f8daf3eb0fa91efde257 Mon Sep 17 00:00:00 2001 From: Meinrad Recheis Date: Sun, 28 Apr 2019 19:56:10 +0200 Subject: [PATCH] added object detection to test suite --- test/TensorFlowNET.Examples/NeuralNetXor.cs | 3 ++- test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/TensorFlowNET.Examples/NeuralNetXor.cs b/test/TensorFlowNET.Examples/NeuralNetXor.cs index c5603d12..73667a51 100644 --- a/test/TensorFlowNET.Examples/NeuralNetXor.cs +++ b/test/TensorFlowNET.Examples/NeuralNetXor.cs @@ -25,13 +25,14 @@ namespace TensorFlowNET.Examples private (Operation, Tensor, Tensor) make_graph(Tensor features,Tensor labels, int num_hidden = 8) { var stddev = 1 / Math.Sqrt(2); - var hidden_weights = tf.Variable(tf.truncated_normal(new int []{2, num_hidden}, stddev: (float) stddev )); + var hidden_weights = tf.Variable(tf.truncated_normal(new int []{2, num_hidden}, seed:1, stddev: (float) stddev )); // Shape [4, num_hidden] var hidden_activations = tf.nn.relu(tf.matmul(features, hidden_weights)); var output_weights = tf.Variable(tf.truncated_normal( new[] {num_hidden, 1}, + seed: 17, stddev: (float) (1 / Math.Sqrt(num_hidden)) )); diff --git a/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs b/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs index b134fbde..92177dc2 100644 --- a/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs +++ b/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs @@ -123,5 +123,11 @@ namespace TensorFlowNET.ExamplesTests } + [TestMethod] + public void ObjectDetection() + { + tf.Graph().as_default(); + Assert.IsTrue(new ObjectDetection() { Enabled = true, ImportGraph = true }.Run()); + } } }