1// This file is MACHINE GENERATED! Do not edit.
2
3#ifndef TENSORFLOW_CC_OPS_CONTROL_FLOW_OPS_H_
4#define TENSORFLOW_CC_OPS_CONTROL_FLOW_OPS_H_
5
6// This file is MACHINE GENERATED! Do not edit.
7
8#include "tensorflow/cc/framework/ops.h"
9#include "tensorflow/cc/framework/scope.h"
10#include "tensorflow/core/framework/tensor.h"
11#include "tensorflow/core/framework/tensor_shape.h"
12#include "tensorflow/core/framework/types.h"
13#include "tensorflow/core/lib/gtl/array_slice.h"
14
15namespace tensorflow {
16namespace ops {
17
18/// @defgroup control_flow_ops Control Flow Ops
19/// @{
20
21/// Raise a exception to abort the process when called.
22///
23/// If exit_without_error is true, the process will exit normally,
24/// otherwise it will exit with a SIGABORT signal.
25///
26/// Returns nothing but an exception.
27///
28/// Args:
29/// * scope: A Scope object
30///
31/// Optional attributes (see `Attrs`):
32/// * error_msg: A string which is the message associated with the exception.
33///
34/// Returns:
35/// * the created `Operation`
36class Abort {
37 public:
38 /// Optional attribute setters for Abort
39 struct Attrs {
40 /// A string which is the message associated with the exception.
41 ///
42 /// Defaults to ""
43 TF_MUST_USE_RESULT Attrs ErrorMsg(StringPiece x) {
44 Attrs ret = *this;
45 ret.error_msg_ = x;
46 return ret;
47 }
48
49 /// Defaults to false
50 TF_MUST_USE_RESULT Attrs ExitWithoutError(bool x) {
51 Attrs ret = *this;
52 ret.exit_without_error_ = x;
53 return ret;
54 }
55
56 StringPiece error_msg_ = "";
57 bool exit_without_error_ = false;
58 };
59 Abort(const ::tensorflow::Scope& scope);
60 Abort(const ::tensorflow::Scope& scope, const Abort::Attrs& attrs);
61 operator ::tensorflow::Operation() const { return operation; }
62
63 static Attrs ErrorMsg(StringPiece x) {
64 return Attrs().ErrorMsg(x);
65 }
66 static Attrs ExitWithoutError(bool x) {
67 return Attrs().ExitWithoutError(x);
68 }
69
70 Operation operation;
71};
72
73/// Does nothing. Serves as a control trigger for scheduling.
74///
75/// Only useful as a placeholder for control edges.
76///
77/// Args:
78/// * scope: A Scope object
79///
80/// Returns:
81/// * the created `Operation`
82class ControlTrigger {
83 public:
84 ControlTrigger(const ::tensorflow::Scope& scope);
85 operator ::tensorflow::Operation() const { return operation; }
86
87 Operation operation;
88};
89
90/// Forwards the input to the output.
91///
92/// This operator represents the loop termination condition used by the
93/// "pivot" switches of a loop.
94///
95/// Args:
96/// * scope: A Scope object
97/// * input: A boolean scalar, representing the branch predicate of the Switch op.
98///
99/// Returns:
100/// * `Output`: The same tensor as `input`.
101class LoopCond {
102 public:
103 LoopCond(const ::tensorflow::Scope& scope, ::tensorflow::Input input);
104 operator ::tensorflow::Output() const { return output; }
105 operator ::tensorflow::Input() const { return output; }
106 ::tensorflow::Node* node() const { return output.node(); }
107
108 Operation operation;
109 ::tensorflow::Output output;
110};
111
112/// Forwards the value of an available tensor from `inputs` to `output`.
113///
114/// `Merge` waits for at least one of the tensors in `inputs` to become available.
115/// It is usually combined with `Switch` to implement branching.
116///
117/// `Merge` forwards the first tensor to become available to `output`, and sets
118/// `value_index` to its index in `inputs`.
119///
120/// Args:
121/// * scope: A Scope object
122/// * inputs: The input tensors, exactly one of which will become available.
123///
124/// Returns:
125/// * `Output` output: Will be set to the available input tensor.
126/// * `Output` value_index: The index of the chosen input tensor in `inputs`.
127class Merge {
128 public:
129 Merge(const ::tensorflow::Scope& scope, ::tensorflow::InputList inputs);
130
131 Operation operation;
132 ::tensorflow::Output output;
133 ::tensorflow::Output value_index;
134};
135
136/// Makes its input available to the next iteration.
137///
138/// Args:
139/// * scope: A Scope object
140/// * data: The tensor to be made available to the next iteration.
141///
142/// Returns:
143/// * `Output`: The same tensor as `data`.
144class NextIteration {
145 public:
146 NextIteration(const ::tensorflow::Scope& scope, ::tensorflow::Input data);
147 operator ::tensorflow::Output() const { return output; }
148 operator ::tensorflow::Input() const { return output; }
149 ::tensorflow::Node* node() const { return output.node(); }
150
151 Operation operation;
152 ::tensorflow::Output output;
153};
154
155/// Makes its input available to the next iteration.
156///
157/// Args:
158/// * scope: A Scope object
159/// * data: The tensor to be made available to the next iteration.
160///
161/// Returns:
162/// * `Output`: The same tensor as `data`.
163class RefNextIteration {
164 public:
165 RefNextIteration(const ::tensorflow::Scope& scope, ::tensorflow::Input data);
166 operator ::tensorflow::Output() const { return output; }
167 operator ::tensorflow::Input() const { return output; }
168 ::tensorflow::Node* node() const { return output.node(); }
169
170 Operation operation;
171 ::tensorflow::Output output;
172};
173
174/// Forwards the `index`th element of `inputs` to `output`.
175///
176/// Args:
177/// * scope: A Scope object
178/// * index: A scalar that determines the input that gets selected.
179/// * inputs: A list of ref tensors, one of which will be forwarded to `output`.
180///
181/// Returns:
182/// * `Output`: The forwarded tensor.
183class RefSelect {
184 public:
185 RefSelect(const ::tensorflow::Scope& scope, ::tensorflow::Input index,
186 ::tensorflow::InputList inputs);
187 operator ::tensorflow::Output() const { return output; }
188 operator ::tensorflow::Input() const { return output; }
189 ::tensorflow::Node* node() const { return output.node(); }
190
191 Operation operation;
192 ::tensorflow::Output output;
193};
194
195/// Forwards the ref tensor `data` to the output port determined by `pred`.
196///
197/// If `pred` is true, the `data` input is forwarded to `output_true`. Otherwise,
198/// the data goes to `output_false`.
199///
200/// See also `Switch` and `Merge`.
201///
202/// Args:
203/// * scope: A Scope object
204/// * data: The ref tensor to be forwarded to the appropriate output.
205/// * pred: A scalar that specifies which output port will receive data.
206///
207/// Returns:
208/// * `Output` output_false: If `pred` is false, data will be forwarded to this output.
209/// * `Output` output_true: If `pred` is true, data will be forwarded to this output.
210class RefSwitch {
211 public:
212 RefSwitch(const ::tensorflow::Scope& scope, ::tensorflow::Input data,
213 ::tensorflow::Input pred);
214
215 Operation operation;
216 ::tensorflow::Output output_false;
217 ::tensorflow::Output output_true;
218};
219
220/// Forwards `data` to the output port determined by `pred`.
221///
222/// If `pred` is true, the `data` input is forwarded to `output_true`. Otherwise,
223/// the data goes to `output_false`.
224///
225/// See also `RefSwitch` and `Merge`.
226///
227/// Args:
228/// * scope: A Scope object
229/// * data: The tensor to be forwarded to the appropriate output.
230/// * pred: A scalar that specifies which output port will receive data.
231///
232/// Returns:
233/// * `Output` output_false: If `pred` is false, data will be forwarded to this output.
234/// * `Output` output_true: If `pred` is true, data will be forwarded to this output.
235class Switch {
236 public:
237 Switch(const ::tensorflow::Scope& scope, ::tensorflow::Input data,
238 ::tensorflow::Input pred);
239
240 Operation operation;
241 ::tensorflow::Output output_false;
242 ::tensorflow::Output output_true;
243};
244
245/// @}
246
247} // namespace ops
248} // namespace tensorflow
249
250#endif // TENSORFLOW_CC_OPS_CONTROL_FLOW_OPS_H_
251