Browse Source

Restore tensor unit tests.

tags/v0.20
Oceania2018 5 years ago
parent
commit
b098c66d8d
12 changed files with 23 additions and 20 deletions
  1. +1
    -2
      test/TensorFlowNET.UnitTest/Basics/SessionTest.cs
  2. +7
    -4
      test/TensorFlowNET.UnitTest/Basics/TensorTest.cs
  3. +2
    -3
      test/TensorFlowNET.UnitTest/GradientTest/GradientTest.cs
  4. +2
    -2
      test/TensorFlowNET.UnitTest/Keras/EmbeddingTest.cs
  5. +0
    -1
      test/TensorFlowNET.UnitTest/NativeAPI/CApiAttributesTestcs.cs
  6. +0
    -1
      test/TensorFlowNET.UnitTest/NativeAPI/CApiColocationTest.cs
  7. +1
    -1
      test/TensorFlowNET.UnitTest/NativeAPI/CApiGradientsTest.cs
  8. +2
    -1
      test/TensorFlowNET.UnitTest/NativeAPI/CApiTest.cs
  9. +2
    -1
      test/TensorFlowNET.UnitTest/TF_API/ZeroFractionTest.cs
  10. +2
    -1
      test/TensorFlowNET.UnitTest/nest_test/NestTest.cs
  11. +2
    -1
      test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs
  12. +2
    -2
      test/TensorFlowNET.UnitTest/ops_test/GraphTest.cs

+ 1
- 2
test/TensorFlowNET.UnitTest/Basics/SessionTest.cs View File

@@ -14,7 +14,6 @@ using static Tensorflow.Binding;

namespace TensorFlowNET.UnitTest.NativeAPI
{
[Ignore]
[TestClass]
public class SessionTest : CApiTest
{
@@ -22,7 +21,7 @@ namespace TensorFlowNET.UnitTest.NativeAPI
/// tensorflow\c\c_api_test.cc
/// `TEST(CAPI, Session)`
/// </summary>
[TestMethod, Ignore]
[TestMethod]
public void Session()
{
lock (Locks.ProcessWide)


+ 7
- 4
test/TensorFlowNET.UnitTest/Basics/TensorTest.cs View File

@@ -11,7 +11,6 @@ using Tensorflow.Framework;

namespace TensorFlowNET.UnitTest.NativeAPI
{
[Ignore]
[TestClass]
public class TensorTest : CApiTest
{
@@ -81,7 +80,7 @@ namespace TensorFlowNET.UnitTest.NativeAPI
/// Port from c_api_test.cc
/// `TEST(CAPI, MaybeMove)`
/// </summary>
[TestMethod]
[TestMethod, Ignore]
public void MaybeMove()
{
NDArray nd = np.array(2, 3);
@@ -262,13 +261,17 @@ namespace TensorFlowNET.UnitTest.NativeAPI
}
}

[TestMethod]
[TestMethod, Ignore]
public void boolean_mask()
{
var tensor = new[] { 0, 1, 2, 3 };
var mask = np.array(new[] { true, false, true, false });
var masked = tf.boolean_mask(tensor, mask);
Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 2 }, masked.ToArray<int>()));
using (var sess = tf.Session())
{
var result = sess.run(masked);
Assert.IsTrue(Enumerable.SequenceEqual(new int[] { 0, 2 }, masked.ToArray<int>()));
}
}
}
}

+ 2
- 3
test/TensorFlowNET.UnitTest/GradientTest/GradientTest.cs View File

@@ -4,13 +4,13 @@ using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NumSharp;
using Tensorflow;
using Tensorflow.UnitTest;
using static Tensorflow.Binding;

namespace TensorFlowNET.UnitTest.Gradient
{
[Ignore]
[TestClass]
public class GradientTest : PythonTest
public class GradientTest : GraphModeTestBase
{
[TestMethod]
public void BroadcastToGrad()
@@ -45,7 +45,6 @@ namespace TensorFlowNET.UnitTest.Gradient
}
}

[Ignore("TODO")]
[TestMethod]
public void testGradients()
{


+ 2
- 2
test/TensorFlowNET.UnitTest/Keras/EmbeddingTest.cs View File

@@ -5,6 +5,7 @@ using System.Text;
using Tensorflow.Keras.Engine;
using Tensorflow.Keras.Layers;
using NumSharp;
using Tensorflow.UnitTest;

namespace TensorFlowNET.UnitTest.Keras
{
@@ -12,9 +13,8 @@ namespace TensorFlowNET.UnitTest.Keras
/// https://www.tensorflow.org/versions/r1.14/api_docs/python/tf/keras/layers/Embedding
/// </summary>
[TestClass]
public class EmbeddingTest
public class EmbeddingTest : GraphModeTestBase
{
[Ignore]
[TestMethod]
public void Embedding()
{


+ 0
- 1
test/TensorFlowNET.UnitTest/NativeAPI/CApiAttributesTestcs.cs View File

@@ -8,7 +8,6 @@ namespace TensorFlowNET.UnitTest.NativeAPI
/// tensorflow\c\c_api_test.cc
/// `class CApiAttributesTest`
/// </summary>
[Ignore]
[TestClass]
public class CApiAttributesTestcs : CApiTest, IDisposable
{


+ 0
- 1
test/TensorFlowNET.UnitTest/NativeAPI/CApiColocationTest.cs View File

@@ -9,7 +9,6 @@ namespace TensorFlowNET.UnitTest.NativeAPI
/// tensorflow\c\c_api_test.cc
/// `class CApiColocationTest`
/// </summary>
[Ignore]
[TestClass]
public class CApiColocationTest : CApiTest, IDisposable
{


+ 1
- 1
test/TensorFlowNET.UnitTest/NativeAPI/CApiGradientsTest.cs View File

@@ -11,7 +11,7 @@ namespace TensorFlowNET.UnitTest.NativeAPI
/// tensorflow\c\c_api_test.cc
/// `class CApiGradientsTest`
/// </summary>
[TestClass, Ignore]
[TestClass]
public class CApiGradientsTest : CApiTest, IDisposable
{
private Graph graph_ = new Graph();


+ 2
- 1
test/TensorFlowNET.UnitTest/NativeAPI/CApiTest.cs View File

@@ -3,11 +3,12 @@ using System;
using Tensorflow;
using Tensorflow.Device;
using Tensorflow.Eager;
using Tensorflow.UnitTest;
using Buffer = System.Buffer;

namespace TensorFlowNET.UnitTest
{
public class CApiTest
public class CApiTest : GraphModeTestBase
{
protected static readonly TF_Code TF_OK = TF_Code.TF_OK;
protected static readonly TF_DataType TF_FLOAT = TF_DataType.TF_FLOAT;


+ 2
- 1
test/TensorFlowNET.UnitTest/TF_API/ZeroFractionTest.cs View File

@@ -3,11 +3,12 @@ using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NumSharp;
using Tensorflow;
using Tensorflow.UnitTest;

namespace TensorFlowNET.UnitTest.nn_test
{
[TestClass]
public class ZeroFractionTest : PythonTest
public class ZeroFractionTest : GraphModeTestBase
{
protected double _ZeroFraction(NDArray x)
{


+ 2
- 1
test/TensorFlowNET.UnitTest/nest_test/NestTest.cs View File

@@ -5,6 +5,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json.Linq;
using NumSharp;
using Tensorflow;
using Tensorflow.UnitTest;
using Tensorflow.Util;
using static Tensorflow.Binding;

@@ -14,7 +15,7 @@ namespace TensorFlowNET.UnitTest.nest_test
/// excerpt of tensorflow/python/framework/util/nest_test.py
/// </summary>
[TestClass]
public class NestTest : PythonTest
public class NestTest : GraphModeTestBase
{
[TestInitialize]
public void TestInitialize()


+ 2
- 1
test/TensorFlowNET.UnitTest/ops_test/CreateOpFromTfOperationTest.cs View File

@@ -3,6 +3,7 @@ using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tensorflow;
using Tensorflow.Operations;
using Tensorflow.UnitTest;
using static Tensorflow.Binding;

namespace TensorFlowNET.UnitTest.ops_test
@@ -19,7 +20,7 @@ namespace TensorFlowNET.UnitTest.ops_test
/// </summary>
[Ignore]
[TestClass]
public class CreateOpFromTfOperationTest : PythonTest
public class CreateOpFromTfOperationTest : GraphModeTestBase
{

[TestMethod]


+ 2
- 2
test/TensorFlowNET.UnitTest/ops_test/GraphTest.cs View File

@@ -1,14 +1,14 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tensorflow;
using Tensorflow.UnitTest;

namespace TensorFlowNET.UnitTest.ops_test
{
/// <summary>
/// excerpt of tensorflow/python/framework/ops_test.py
/// </summary>
[Ignore]
[TestClass]
public class GraphTest : PythonTest
public class GraphTest : GraphModeTestBase
{

[TestInitialize]


Loading…
Cancel
Save