forked from SciSharp/TensorFlow.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc_api.ops.cs
More file actions
93 lines (83 loc) · 4.09 KB
/
c_api.ops.cs
File metadata and controls
93 lines (83 loc) · 4.09 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace Tensorflow
{
public partial class c_api
{
/// <summary>
/// Fills in `value` with the value of the attribute `attr_name`. `value` must
/// point to an array of length at least `max_length` (ideally set to
/// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper,
/// attr_name)).
/// </summary>
/// <param name="oper">TF_Operation*</param>
/// <param name="attr_name">const char*</param>
/// <param name="status">TF_Status*</param>
/// <returns></returns>
[DllImport(TensorFlowLibName)]
public static extern TF_AttrMetadata TF_OperationGetAttrMetadata(IntPtr oper, string attr_name, IntPtr status);
/// <summary>
/// Fills in `value` with the value of the attribute `attr_name`. `value` must
/// point to an array of length at least `max_length` (ideally set to
/// TF_AttrMetadata.total_size from TF_OperationGetAttrMetadata(oper,
/// attr_name)).
/// </summary>
/// <param name="oper">TF_Operation*</param>
/// <param name="attr_name">const char*</param>
/// <param name="value">void* </param>
/// <param name="max_length">size_t</param>
/// <param name="status">TF_Status*</param>
[DllImport(TensorFlowLibName)]
public static extern void TF_OperationGetAttrString(IntPtr oper, string attr_name, IntPtr value, uint max_length, IntPtr status);
/// <summary>
/// Sets `output_attr_value` to the binary-serialized AttrValue proto
/// representation of the value of the `attr_name` attr of `oper`.
/// </summary>
/// <param name="oper"></param>
/// <returns></returns>
[DllImport(TensorFlowLibName)]
public static extern int TF_OperationGetAttrValueProto(IntPtr oper, string attr_name, IntPtr output_attr_value, IntPtr status);
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrBool(IntPtr desc, string attr_name, bool value);
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrValueProto(IntPtr desc, string attr_name, IntPtr proto, uint proto_len, IntPtr status);
/// <summary>
/// Set `num_dims` to -1 to represent "unknown rank".
/// </summary>
/// <param name="desc"></param>
/// <param name="attr_name"></param>
/// <param name="dims"></param>
/// <param name="num_dims"></param>
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrShape(IntPtr desc, string attr_name, long[] dims, int num_dims);
/// <summary>
/// Call some TF_SetAttr*() function for every attr that is not
/// inferred from an input and doesn't have a default value you wish to
/// keep.
///
/// `value` must point to a string of length `length` bytes.
/// </summary>
/// <param name="desc">TF_OperationDescription*</param>
/// <param name="attr_name">const char*</param>
/// <param name="value">const void*</param>
/// <param name="length">size_t</param>
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrString(IntPtr desc, string attr_name, string value, uint length);
/// <summary>
///
/// </summary>
/// <param name="desc"></param>
/// <param name="attr_name"></param>
/// <param name="values"></param>
/// <param name="lengths"></param>
/// <param name="num_values"></param>
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrStringList(IntPtr desc, string attr_name, IntPtr[] values, uint[] lengths, int num_values);
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrTensor(IntPtr desc, string attr_name, IntPtr value, IntPtr status);
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrType(IntPtr desc, string attr_name, TF_DataType value);
}
}