Skip to content

Commit a883898

Browse files
committed
Add graph to function test.
1 parent d4f1c34 commit a883898

16 files changed

+182
-9
lines changed

test/TensorFlowNET.UnitTest/Keras/LayersTest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,23 @@ public void Sequential()
3030
public void Embedding()
3131
{
3232
var model = tf.keras.Sequential();
33-
var layer = tf.keras.layers.Embedding(1000, 64, input_length: 10);
33+
var layer = tf.keras.layers.Embedding(7, 2, input_length: 4);
3434
model.add(layer);
3535
// the model will take as input an integer matrix of size (batch,
3636
// input_length).
3737
// the largest integer (i.e. word index) in the input should be no larger
3838
// than 999 (vocabulary size).
3939
// now model.output_shape == (None, 10, 64), where None is the batch
4040
// dimension.
41-
var input_array = np.random.randint(1000, size: (32, 10));
41+
var input_array = np.array(new int[,]
42+
{
43+
{ 1, 2, 3, 4 },
44+
{ 2, 3, 4, 5 },
45+
{ 3, 4, 5, 6 }
46+
});
4247
model.compile("rmsprop", "mse");
4348
var output_array = model.predict(input_array);
49+
Assert.AreEqual((32, 10, 64), output_array.TensorShape);
4450
}
4551

4652
/// <summary>

test/TensorFlowNET.UnitTest/TF_API/BitwiseApiTest.cs renamed to test/TensorFlowNET.UnitTest/ManagedAPI/BitwiseApiTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
using Tensorflow;
44
using static Tensorflow.Binding;
55

6-
namespace TensorFlowNET.UnitTest.TF_API
6+
namespace TensorFlowNET.UnitTest.ManagedAPI
77
{
88
[TestClass]
99
public class BitwiseApiTest : TFNetApiTest

test/TensorFlowNET.UnitTest/TF_API/GradientTest.cs renamed to test/TensorFlowNET.UnitTest/ManagedAPI/GradientTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Tensorflow;
66
using static Tensorflow.Binding;
77

8-
namespace TensorFlowNET.UnitTest.TF_API
8+
namespace TensorFlowNET.UnitTest.ManagedAPI
99
{
1010
[TestClass]
1111
public class GradientTest

test/TensorFlowNET.UnitTest/TF_API/LinalgTest.cs renamed to test/TensorFlowNET.UnitTest/ManagedAPI/LinalgTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Text;
55
using static Tensorflow.Binding;
66

7-
namespace TensorFlowNET.UnitTest.TF_API
7+
namespace TensorFlowNET.UnitTest.ManagedAPI
88
{
99
[TestClass]
1010
public class LinalgTest

test/TensorFlowNET.UnitTest/TF_API/MathApiTest.cs renamed to test/TensorFlowNET.UnitTest/ManagedAPI/MathApiTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Tensorflow;
77
using static Tensorflow.Binding;
88

9-
namespace TensorFlowNET.UnitTest.TF_API
9+
namespace TensorFlowNET.UnitTest.ManagedAPI
1010
{
1111
[TestClass]
1212
public class MathApiTest : TFNetApiTest

test/TensorFlowNET.UnitTest/TF_API/StringsApiTest.cs renamed to test/TensorFlowNET.UnitTest/ManagedAPI/StringsApiTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Tensorflow;
66
using static Tensorflow.Binding;
77

8-
namespace TensorFlowNET.UnitTest.TF_API
8+
namespace TensorFlowNET.UnitTest.ManagedAPI
99
{
1010
[TestClass]
1111
public class StringsApiTest

test/TensorFlowNET.UnitTest/TF_API/TensorOperate.cs renamed to test/TensorFlowNET.UnitTest/ManagedAPI/TensorOperate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Tensorflow;
66
using static Tensorflow.Binding;
77

8-
namespace TensorFlowNET.UnitTest.TF_API
8+
namespace TensorFlowNET.UnitTest.ManagedAPI
99
{
1010
[TestClass]
1111
public class TensorOperate

0 commit comments

Comments
 (0)