2
2
3
3
package org .tensorflow .internal .c_api ;
4
4
5
- import org .bytedeco .javacpp .BytePointer ;
6
- import org .bytedeco .javacpp .Loader ;
7
- import org .bytedeco .javacpp .Pointer ;
8
- import org .bytedeco .javacpp .annotation .Cast ;
9
- import org .bytedeco .javacpp .annotation .Name ;
10
- import org .bytedeco .javacpp .annotation .NoOffset ;
11
- import org .bytedeco .javacpp .annotation .Properties ;
12
- import org .bytedeco .javacpp .annotation .StdString ;
5
+ import java .nio .*;
6
+ import org .bytedeco .javacpp .*;
7
+ import org .bytedeco .javacpp .annotation .*;
8
+
9
+ import static org .tensorflow .internal .c_api .global .tensorflow .*;
13
10
14
11
// Parsed from tensorflow/core/graph/graph.h
15
12
16
- @ Name ("tensorflow::Node" )
17
- @ NoOffset
18
- @ Properties (inherit = org .tensorflow .internal .c_api .presets .tensorflow .class )
13
+ @ Name ("tensorflow::Node" ) @ NoOffset @ Properties (inherit = org .tensorflow .internal .c_api .presets .tensorflow .class )
19
14
public class Node extends Pointer {
15
+ static { Loader .load (); }
16
+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
17
+ public Node (Pointer p ) { super (p ); }
20
18
21
- static {
22
- Loader .load ();
23
- }
24
-
25
- /**
26
- * Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}.
27
- */
28
- public Node (Pointer p ) {
29
- super (p );
30
- }
31
-
32
- public native @ StdString
33
- BytePointer DebugString ();
34
-
19
+ public native @ StdString BytePointer DebugString ();
35
20
public native int id ();
36
-
37
21
public native int cost_id ();
38
-
39
- public native @ StdString
40
- BytePointer name ();
41
-
22
+ public native @ StdString BytePointer name ();
42
23
public native void set_name (@ StdString BytePointer name );
43
-
44
24
public native void set_name (@ StdString String name );
45
-
46
- public native @ StdString
47
- BytePointer type_string ();
25
+ public native @ StdString BytePointer type_string ();
48
26
49
27
// def() provides the NodeDef the user supplied, but the specifics
50
28
// of this Node may have changed due to placement, optimization, etc.
@@ -58,21 +36,17 @@ public Node(Pointer p) {
58
36
// TODO(irving): Replace with NodeInfo.
59
37
60
38
// input and output types
61
- public native @ Cast ("tensorflow::int32" )
62
- int num_inputs ();
39
+ public native @ Cast ("tensorflow::int32" ) int num_inputs ();
63
40
64
- public native @ Cast ("tensorflow::int32" )
65
- int num_outputs ();
41
+ public native @ Cast ("tensorflow::int32" ) int num_outputs ();
66
42
67
43
// The device requested by the user. For the actual assigned device,
68
44
// use assigned_device_name() below.
69
- public native @ StdString
70
- BytePointer requested_device ();
45
+ public native @ StdString BytePointer requested_device ();
71
46
72
47
// This changes the user requested device but not necessarily the device that
73
48
// on which the operation will run.
74
49
public native void set_requested_device (@ StdString BytePointer device );
75
-
76
50
public native void set_requested_device (@ StdString String device );
77
51
78
52
// This gives the device the runtime has assigned this node to. If
@@ -81,22 +55,16 @@ public Node(Pointer p) {
81
55
// fully specifies a device, and satisfies def().device().
82
56
// TODO(josh11b): Move assigned_device_name outside of Node into a
83
57
// NodeId->DeviceName map.
84
- public native @ StdString
85
- BytePointer assigned_device_name ();
86
-
58
+ public native @ StdString BytePointer assigned_device_name ();
87
59
public native void set_assigned_device_name (@ StdString BytePointer device_name );
88
-
89
60
public native void set_assigned_device_name (@ StdString String device_name );
90
-
91
- public native @ Cast ("bool" )
92
- boolean has_assigned_device_name ();
93
-
61
+ public native @ Cast ("bool" ) boolean has_assigned_device_name ();
94
62
public native int assigned_device_name_index ();
95
-
96
63
public native void set_assigned_device_name_index (int index );
97
64
98
65
// Sets 'original_node_names' field of this node's DebugInfo proto to
99
66
// 'names'.
67
+
100
68
101
69
// Read only access to attributes
102
70
@@ -106,109 +74,56 @@ public Node(Pointer p) {
106
74
// includes control edges.
107
75
108
76
// Node type helpers.
109
- public native @ Cast ("bool" )
110
- boolean IsSource ();
111
-
112
- public native @ Cast ("bool" )
113
- boolean IsSink ();
114
-
77
+ public native @ Cast ("bool" ) boolean IsSource ();
78
+ public native @ Cast ("bool" ) boolean IsSink ();
115
79
// Anything other than the special Source & Sink nodes.
116
- public native @ Cast ("bool" )
117
- boolean IsOp ();
80
+ public native @ Cast ("bool" ) boolean IsOp ();
118
81
119
82
// Node class helpers
120
- public native @ Cast ("bool" )
121
- boolean IsSwitch ();
122
-
123
- public native @ Cast ("bool" )
124
- boolean IsMerge ();
125
-
126
- public native @ Cast ("bool" )
127
- boolean IsEnter ();
128
-
129
- public native @ Cast ("bool" )
130
- boolean IsExit ();
131
-
132
- public native @ Cast ("bool" )
133
- boolean IsNextIteration ();
134
-
135
- public native @ Cast ("bool" )
136
- boolean IsLoopCond ();
137
-
138
- public native @ Cast ("bool" )
139
- boolean IsControlTrigger ();
140
-
141
- public native @ Cast ("bool" )
142
- boolean IsSend ();
143
-
144
- public native @ Cast ("bool" )
145
- boolean IsRecv ();
146
-
147
- public native @ Cast ("bool" )
148
- boolean IsConstant ();
149
-
150
- public native @ Cast ("bool" )
151
- boolean IsVariable ();
152
-
153
- public native @ Cast ("bool" )
154
- boolean IsIdentity ();
155
-
156
- public native @ Cast ("bool" )
157
- boolean IsGetSessionHandle ();
158
-
159
- public native @ Cast ("bool" )
160
- boolean IsGetSessionTensor ();
161
-
162
- public native @ Cast ("bool" )
163
- boolean IsDeleteSessionTensor ();
164
-
165
- public native @ Cast ("bool" )
166
- boolean IsControlFlow ();
167
-
168
- public native @ Cast ("bool" )
169
- boolean IsHostSend ();
170
-
171
- public native @ Cast ("bool" )
172
- boolean IsHostRecv ();
173
-
174
- public native @ Cast ("bool" )
175
- boolean IsScopedAllocator ();
176
-
177
- public native @ Cast ("bool" )
178
- boolean IsCollective ();
179
-
180
- public native @ Cast ("bool" )
181
- boolean IsMetadata ();
182
-
183
- public native @ Cast ("bool" )
184
- boolean IsFakeParam ();
185
-
186
- public native @ Cast ("bool" )
187
- boolean IsPartitionedCall ();
83
+ public native @ Cast ("bool" ) boolean IsSwitch ();
84
+ public native @ Cast ("bool" ) boolean IsMerge ();
85
+ public native @ Cast ("bool" ) boolean IsEnter ();
86
+ public native @ Cast ("bool" ) boolean IsExit ();
87
+ public native @ Cast ("bool" ) boolean IsNextIteration ();
88
+ public native @ Cast ("bool" ) boolean IsLoopCond ();
89
+ public native @ Cast ("bool" ) boolean IsControlTrigger ();
90
+ public native @ Cast ("bool" ) boolean IsSend ();
91
+ public native @ Cast ("bool" ) boolean IsRecv ();
92
+ public native @ Cast ("bool" ) boolean IsConstant ();
93
+ public native @ Cast ("bool" ) boolean IsVariable ();
94
+ public native @ Cast ("bool" ) boolean IsIdentity ();
95
+ public native @ Cast ("bool" ) boolean IsGetSessionHandle ();
96
+ public native @ Cast ("bool" ) boolean IsGetSessionTensor ();
97
+ public native @ Cast ("bool" ) boolean IsDeleteSessionTensor ();
98
+ public native @ Cast ("bool" ) boolean IsControlFlow ();
99
+ public native @ Cast ("bool" ) boolean IsHostSend ();
100
+ public native @ Cast ("bool" ) boolean IsHostRecv ();
101
+ public native @ Cast ("bool" ) boolean IsScopedAllocator ();
102
+ public native @ Cast ("bool" ) boolean IsCollective ();
103
+
104
+ public native @ Cast ("bool" ) boolean IsMetadata ();
105
+ public native @ Cast ("bool" ) boolean IsFakeParam ();
106
+ public native @ Cast ("bool" ) boolean IsPartitionedCall ();
188
107
189
108
// Returns true if this node is any kind of function call node.
190
109
//
191
110
// NOTE: "function call nodes" include partitioned call ops, symbolic gradient
192
111
// ops, and ops whose type_string is the name of a function ("function ops").
193
- public native @ Cast ("bool" )
194
- boolean IsFunctionCall ();
112
+ public native @ Cast ("bool" ) boolean IsFunctionCall ();
195
113
196
- public native @ Cast ("bool" )
197
- boolean IsIfNode ();
114
+ public native @ Cast ("bool" ) boolean IsIfNode ();
115
+ public native @ Cast ("bool" ) boolean IsWhileNode ();
116
+ public native @ Cast ("bool" ) boolean IsCaseNode ();
117
+ // Is this node a function input
118
+ public native @ Cast ("bool" ) boolean IsArg ();
119
+ // Is this node a function output
120
+ public native @ Cast ("bool" ) boolean IsRetval ();
198
121
199
- public native @ Cast ("bool" )
200
- boolean IsWhileNode ();
122
+
201
123
202
- public native @ Cast ("bool" )
203
- boolean IsCaseNode ();
124
+
204
125
205
- // Is this node a function input
206
- public native @ Cast ("bool" )
207
- boolean IsArg ();
208
-
209
- // Is this node a function output
210
- public native @ Cast ("bool" )
211
- boolean IsRetval ();
126
+
212
127
213
128
// Returns into '*e' the edge connecting to the 'idx' input of this Node.
214
129
@@ -217,6 +132,8 @@ public Node(Pointer p) {
217
132
218
133
// Returns into '*n' the node that has an output connected to the
219
134
// 'idx' input of this Node.
135
+
136
+
220
137
221
138
// Returns into '*t' the idx-th input tensor of this node, represented as the
222
139
// output tensor of input_node(idx).
0 commit comments