22
33package org .tensorflow .internal .c_api ;
44
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 .*;
1310
1411// Parsed from tensorflow/core/graph/graph.h
1512
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 )
1914public class Node extends Pointer {
15+ static { Loader .load (); }
16+ /** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
17+ public Node (Pointer p ) { super (p ); }
2018
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 ();
3520 public native int id ();
36-
3721 public native int cost_id ();
38-
39- public native @ StdString
40- BytePointer name ();
41-
22+ public native @ StdString BytePointer name ();
4223 public native void set_name (@ StdString BytePointer name );
43-
4424 public native void set_name (@ StdString String name );
45-
46- public native @ StdString
47- BytePointer type_string ();
25+ public native @ StdString BytePointer type_string ();
4826
4927 // def() provides the NodeDef the user supplied, but the specifics
5028 // of this Node may have changed due to placement, optimization, etc.
@@ -58,21 +36,17 @@ public Node(Pointer p) {
5836 // TODO(irving): Replace with NodeInfo.
5937
6038 // input and output types
61- public native @ Cast ("tensorflow::int32" )
62- int num_inputs ();
39+ public native @ Cast ("tensorflow::int32" ) int num_inputs ();
6340
64- public native @ Cast ("tensorflow::int32" )
65- int num_outputs ();
41+ public native @ Cast ("tensorflow::int32" ) int num_outputs ();
6642
6743 // The device requested by the user. For the actual assigned device,
6844 // use assigned_device_name() below.
69- public native @ StdString
70- BytePointer requested_device ();
45+ public native @ StdString BytePointer requested_device ();
7146
7247 // This changes the user requested device but not necessarily the device that
7348 // on which the operation will run.
7449 public native void set_requested_device (@ StdString BytePointer device );
75-
7650 public native void set_requested_device (@ StdString String device );
7751
7852 // This gives the device the runtime has assigned this node to. If
@@ -81,22 +55,16 @@ public Node(Pointer p) {
8155 // fully specifies a device, and satisfies def().device().
8256 // TODO(josh11b): Move assigned_device_name outside of Node into a
8357 // NodeId->DeviceName map.
84- public native @ StdString
85- BytePointer assigned_device_name ();
86-
58+ public native @ StdString BytePointer assigned_device_name ();
8759 public native void set_assigned_device_name (@ StdString BytePointer device_name );
88-
8960 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 ();
9462 public native int assigned_device_name_index ();
95-
9663 public native void set_assigned_device_name_index (int index );
9764
9865 // Sets 'original_node_names' field of this node's DebugInfo proto to
9966 // 'names'.
67+
10068
10169 // Read only access to attributes
10270
@@ -106,109 +74,56 @@ public Node(Pointer p) {
10674 // includes control edges.
10775
10876 // 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 ();
11579 // Anything other than the special Source & Sink nodes.
116- public native @ Cast ("bool" )
117- boolean IsOp ();
80+ public native @ Cast ("bool" ) boolean IsOp ();
11881
11982 // 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 ();
188107
189108 // Returns true if this node is any kind of function call node.
190109 //
191110 // NOTE: "function call nodes" include partitioned call ops, symbolic gradient
192111 // 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 ();
195113
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 ();
198121
199- public native @ Cast ("bool" )
200- boolean IsWhileNode ();
122+
201123
202- public native @ Cast ("bool" )
203- boolean IsCaseNode ();
124+
204125
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+
212127
213128 // Returns into '*e' the edge connecting to the 'idx' input of this Node.
214129
@@ -217,6 +132,8 @@ public Node(Pointer p) {
217132
218133 // Returns into '*n' the node that has an output connected to the
219134 // 'idx' input of this Node.
135+
136+
220137
221138 // Returns into '*t' the idx-th input tensor of this node, represented as the
222139 // output tensor of input_node(idx).
0 commit comments