| @@ -5,7 +5,7 @@ using System.Linq; | |||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.UnitTest.TF_API | |||||
| namespace TensorFlowNET.UnitTest.TF_API | |||||
| { | { | ||||
| [TestClass] | [TestClass] | ||||
| public class GradientTest | public class GradientTest | ||||
| @@ -4,7 +4,7 @@ using System.Collections.Generic; | |||||
| using System.Text; | using System.Text; | ||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.UnitTest.TF_API | |||||
| namespace TensorFlowNET.UnitTest.TF_API | |||||
| { | { | ||||
| [TestClass] | [TestClass] | ||||
| public class LinalgTest | public class LinalgTest | ||||
| @@ -13,6 +13,7 @@ namespace TensorFlowNET.UnitTest.TF_API | |||||
| { | { | ||||
| // A constant vector of size 6 | // A constant vector of size 6 | ||||
| Tensor a = tf.constant(new float[] { 1.0f, -0.5f, 3.4f, -2.1f, 0.0f, -6.5f }); | Tensor a = tf.constant(new float[] { 1.0f, -0.5f, 3.4f, -2.1f, 0.0f, -6.5f }); | ||||
| Tensor b = tf.constant(new float[,] { { 1.0f, -0.5f, 3.4f }, { -2.1f, 0.0f, -6.5f } }); | |||||
| [TestMethod] | [TestMethod] | ||||
| public void Sin() | public void Sin() | ||||
| @@ -31,5 +32,24 @@ namespace TensorFlowNET.UnitTest.TF_API | |||||
| var actual = b.ToArray<float>(); | var actual = b.ToArray<float>(); | ||||
| Assert.IsTrue(Equal(expected, actual)); | Assert.IsTrue(Equal(expected, actual)); | ||||
| } | } | ||||
| [TestMethod] | |||||
| public void ReduceSum() | |||||
| { | |||||
| var x1 = tf.reduce_sum(b); | |||||
| Assert.AreEqual(-4.7f, (float)x1); | |||||
| var x2 = tf.reduce_sum(b, 0); | |||||
| Assert.IsTrue(Enumerable.SequenceEqual(new[] { -1.0999999f, -0.5f, -3.1f }, x2.ToArray<float>())); | |||||
| var x3 = tf.reduce_sum(b, 1); | |||||
| Assert.IsTrue(Enumerable.SequenceEqual(new[] { 3.9f, -8.6f }, x3.ToArray<float>())); | |||||
| var x4 = tf.reduce_sum(b, 1, keepdims: true); | |||||
| Assert.AreEqual((2, 1), x4.TensorShape); | |||||
| var x5 = tf.reduce_sum(b, (0, 1)); | |||||
| Assert.AreEqual(-4.7f, (float)x5); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -2,9 +2,10 @@ | |||||
| using System; | using System; | ||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||
| using System.Text; | using System.Text; | ||||
| using Tensorflow; | |||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.UnitTest.TF_API | |||||
| namespace TensorFlowNET.UnitTest.TF_API | |||||
| { | { | ||||
| [TestClass] | [TestClass] | ||||
| public class StringsApiTest | public class StringsApiTest | ||||
| @@ -5,7 +5,7 @@ using System.Linq; | |||||
| using Tensorflow; | using Tensorflow; | ||||
| using static Tensorflow.Binding; | using static Tensorflow.Binding; | ||||
| namespace Tensorflow.UnitTest.TF_API | |||||
| namespace TensorFlowNET.UnitTest.TF_API | |||||
| { | { | ||||
| [TestClass] | [TestClass] | ||||
| public class TensorOperate | public class TensorOperate | ||||
| @@ -3,7 +3,7 @@ using System.Collections.Generic; | |||||
| using System.IO; | using System.IO; | ||||
| using System.Text; | using System.Text; | ||||
| namespace Tensorflow.UnitTest | |||||
| namespace TensorFlowNET.UnitTest | |||||
| { | { | ||||
| public class TestHelper | public class TestHelper | ||||
| { | { | ||||