forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCApiTest.cs
More file actions
70 lines (58 loc) · 1.92 KB
/
CApiTest.cs
File metadata and controls
70 lines (58 loc) · 1.92 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
68
69
70
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Text;
using Tensorflow;
using static Tensorflow.Python;
namespace TensorFlowNET.UnitTest
{
public class CApiTest
{
protected TF_Code TF_OK = TF_Code.TF_OK;
protected TF_DataType TF_FLOAT = TF_DataType.TF_FLOAT;
protected void EXPECT_TRUE(bool expected)
{
Assert.IsTrue(expected);
}
protected void EXPECT_EQ(object expected, object actual)
{
Assert.AreEqual(expected, actual);
}
protected void ASSERT_EQ(object expected, object actual)
{
Assert.AreEqual(expected, actual);
}
protected void ASSERT_TRUE(bool condition)
{
Assert.IsTrue(condition);
}
protected OperationDescription TF_NewOperation(Graph graph, string opType, string opName)
{
return c_api.TF_NewOperation(graph, opType, opName);
}
protected void TF_AddInput(OperationDescription desc, TF_Output input)
{
c_api.TF_AddInput(desc, input);
}
protected Operation TF_FinishOperation(OperationDescription desc, Status s)
{
return c_api.TF_FinishOperation(desc, s);
}
protected void TF_SetAttrTensor(OperationDescription desc, string attrName, Tensor value, Status s)
{
c_api.TF_SetAttrTensor(desc, attrName, value, s);
}
protected void TF_SetAttrType(OperationDescription desc, string attrName, TF_DataType dtype)
{
c_api.TF_SetAttrType(desc, attrName, dtype);
}
protected void TF_SetAttrBool(OperationDescription desc, string attrName, bool value)
{
c_api.TF_SetAttrBool(desc, attrName, value);
}
protected TF_Code TF_GetCode(Status s)
{
return s.Code;
}
}
}