From 1b347a833b147c8d6463ee7fbe9c0527fc518691 Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Sat, 26 Jan 2019 09:56:25 -0600 Subject: [PATCH] VariableTest.Initializer OK --- src/TensorFlowNET.Core/TensorFlowNET.Core.csproj | 2 +- .../TensorFlowNET.Examples.csproj | 2 +- .../TensorFlowNET.UnitTest.csproj | 2 +- test/TensorFlowNET.UnitTest/VariableTest.cs | 15 ++++++++++++++- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj index 49f9ae1c..92012ac8 100644 --- a/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj +++ b/src/TensorFlowNET.Core/TensorFlowNET.Core.csproj @@ -36,7 +36,7 @@ Docs: https://tensorflownet.readthedocs.io - + diff --git a/test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj b/test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj index c66a7461..d919ac36 100644 --- a/test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj +++ b/test/TensorFlowNET.Examples/TensorFlowNET.Examples.csproj @@ -6,7 +6,7 @@ - + diff --git a/test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj b/test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj index 16a5fed3..07f8d132 100644 --- a/test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj +++ b/test/TensorFlowNET.UnitTest/TensorFlowNET.UnitTest.csproj @@ -19,7 +19,7 @@ - + diff --git a/test/TensorFlowNET.UnitTest/VariableTest.cs b/test/TensorFlowNET.UnitTest/VariableTest.cs index 9083045e..3bf2cea9 100644 --- a/test/TensorFlowNET.UnitTest/VariableTest.cs +++ b/test/TensorFlowNET.UnitTest/VariableTest.cs @@ -3,12 +3,26 @@ using System; using System.Collections.Generic; using System.Text; using Tensorflow; +using NumSharp.Core; namespace TensorFlowNET.UnitTest { [TestClass] public class VariableTest : Python { + [TestMethod] + public void Initializer() + { + var x = tf.Variable(10, name: "x"); + + using (var session = tf.Session()) + { + session.run(x.initializer); + var result = session.run(x); + Assert.AreEqual(10, (int)result); + } + } + [TestMethod] public void StringVar() { @@ -43,7 +57,6 @@ namespace TensorFlowNET.UnitTest print(result); } } - } } }