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
107 lines (93 loc) · 4.86 KB
/
c_api.ops.cs
File metadata and controls
107 lines (93 loc) · 4.86 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*****************************************************************************
Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
******************************************************************************/
using System;
using System.Runtime.InteropServices;
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, SafeStatusHandle 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, SafeStatusHandle 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, SafeBufferHandle output_attr_value, SafeStatusHandle 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, byte[] proto, int proto_len, SafeStatusHandle 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, SafeTensorHandle value, SafeStatusHandle status);
[DllImport(TensorFlowLibName)]
public static extern void TF_SetAttrType(IntPtr desc, string attr_name, TF_DataType value);
}
}