forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTensorShapeTest.cs
More file actions
67 lines (60 loc) · 1.74 KB
/
TensorShapeTest.cs
File metadata and controls
67 lines (60 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using NumSharp;
using Tensorflow;
using static Tensorflow.Binding;
namespace TensorFlowNET.UnitTest
{
[TestClass]
public class TensorShapeTest
{
[TestMethod]
public void Case1()
{
int a = 2;
int b = 3;
var dims = new [] { Unknown, a, b};
new TensorShape(dims).GetPrivate<Shape>("shape").Should().BeShaped(-1, 2, 3);
}
[TestMethod]
public void Case2()
{
int a = 2;
int b = 3;
var dims = new[] { Unknown, a, b};
new TensorShape(new [] {dims}).GetPrivate<Shape>("shape").Should().BeShaped(-1, 2, 3);
}
[TestMethod]
public void Case3()
{
int a = 2;
int b = Unknown;
var dims = new [] { Unknown, a, b};
new TensorShape(new [] {dims}).GetPrivate<Shape>("shape").Should().BeShaped(-1, 2, -1);
}
[TestMethod]
public void Case4()
{
TensorShape shape = (Unknown, Unknown);
shape.GetPrivate<Shape>("shape").Should().BeShaped(-1, -1);
}
[TestMethod]
public void Case5()
{
TensorShape shape = (1, Unknown, 3);
shape.GetPrivate<Shape>("shape").Should().BeShaped(1, -1, 3);
}
[TestMethod]
public void Case6()
{
TensorShape shape = (Unknown, 1, 2, 3, Unknown);
shape.GetPrivate<Shape>("shape").Should().BeShaped(-1, 1, 2, 3, -1);
}
[TestMethod]
public void Case7()
{
TensorShape shape = new TensorShape();
Assert.AreEqual(shape.rank, -1);
}
}
}