1 | // This file is MACHINE GENERATED! Do not edit. |
2 | |
3 | #ifndef TENSORFLOW_CC_OPS_DATASET_OPS_H_ |
4 | #define TENSORFLOW_CC_OPS_DATASET_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 | |
15 | namespace tensorflow { |
16 | namespace ops { |
17 | |
18 | /// @defgroup dataset_ops Dataset Ops |
19 | /// @{ |
20 | |
21 | /// A container for an iterator resource. |
22 | /// |
23 | /// Args: |
24 | /// * scope: A Scope object |
25 | /// |
26 | /// Returns: |
27 | /// * `Output`: A handle to the iterator that can be passed to a "MakeIterator" or |
28 | /// "IteratorGetNext" op. In contrast to Iterator, AnonymousIterator prevents |
29 | /// resource sharing by name, and does not keep a reference to the resource |
30 | /// container. |
31 | class AnonymousIterator { |
32 | public: |
33 | AnonymousIterator(const ::tensorflow::Scope& scope, const DataTypeSlice& |
34 | output_types, const gtl::ArraySlice<PartialTensorShape>& |
35 | output_shapes); |
36 | operator ::tensorflow::Output() const { return handle; } |
37 | operator ::tensorflow::Input() const { return handle; } |
38 | ::tensorflow::Node* node() const { return handle.node(); } |
39 | |
40 | Operation operation; |
41 | ::tensorflow::Output handle; |
42 | }; |
43 | |
44 | /// Converts the given variant tensor to an iterator and stores it in the given resource. |
45 | /// |
46 | /// Args: |
47 | /// * scope: A Scope object |
48 | /// * resource_handle: A handle to an iterator resource. |
49 | /// * serialized: A variant tensor storing the state of the iterator contained in the |
50 | /// resource. |
51 | /// |
52 | /// Returns: |
53 | /// * the created `Operation` |
54 | class DeserializeIterator { |
55 | public: |
56 | DeserializeIterator(const ::tensorflow::Scope& scope, ::tensorflow::Input |
57 | resource_handle, ::tensorflow::Input serialized); |
58 | operator ::tensorflow::Operation() const { return operation; } |
59 | |
60 | Operation operation; |
61 | }; |
62 | |
63 | /// A container for an iterator resource. |
64 | /// |
65 | /// Args: |
66 | /// * scope: A Scope object |
67 | /// |
68 | /// Returns: |
69 | /// * `Output`: A handle to the iterator that can be passed to a "MakeIterator" |
70 | /// or "IteratorGetNext" op. |
71 | class Iterator { |
72 | public: |
73 | Iterator(const ::tensorflow::Scope& scope, StringPiece shared_name, StringPiece |
74 | container, const DataTypeSlice& output_types, const |
75 | gtl::ArraySlice<PartialTensorShape>& output_shapes); |
76 | operator ::tensorflow::Output() const { return handle; } |
77 | operator ::tensorflow::Input() const { return handle; } |
78 | ::tensorflow::Node* node() const { return handle.node(); } |
79 | |
80 | Operation operation; |
81 | ::tensorflow::Output handle; |
82 | }; |
83 | |
84 | /// Converts the given string representing a handle to an iterator to a resource. |
85 | /// |
86 | /// Args: |
87 | /// * scope: A Scope object |
88 | /// * string_handle: A string representation of the given handle. |
89 | /// |
90 | /// Optional attributes (see `Attrs`): |
91 | /// * output_types: If specified, defines the type of each tuple component in an |
92 | /// element produced by the resulting iterator. |
93 | /// * output_shapes: If specified, defines the shape of each tuple component in an |
94 | /// element produced by the resulting iterator. |
95 | /// |
96 | /// Returns: |
97 | /// * `Output`: A handle to an iterator resource. |
98 | class IteratorFromStringHandle { |
99 | public: |
100 | /// Optional attribute setters for IteratorFromStringHandle |
101 | struct Attrs { |
102 | /// If specified, defines the type of each tuple component in an |
103 | /// element produced by the resulting iterator. |
104 | /// |
105 | /// Defaults to [] |
106 | TF_MUST_USE_RESULT Attrs OutputTypes(const DataTypeSlice& x) { |
107 | Attrs ret = *this; |
108 | ret.output_types_ = x; |
109 | return ret; |
110 | } |
111 | |
112 | /// If specified, defines the shape of each tuple component in an |
113 | /// element produced by the resulting iterator. |
114 | /// |
115 | /// Defaults to [] |
116 | TF_MUST_USE_RESULT Attrs OutputShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
117 | Attrs ret = *this; |
118 | ret.output_shapes_ = x; |
119 | return ret; |
120 | } |
121 | |
122 | DataTypeSlice output_types_ = {}; |
123 | gtl::ArraySlice<PartialTensorShape> output_shapes_ = {}; |
124 | }; |
125 | IteratorFromStringHandle(const ::tensorflow::Scope& scope, ::tensorflow::Input |
126 | string_handle); |
127 | IteratorFromStringHandle(const ::tensorflow::Scope& scope, ::tensorflow::Input |
128 | string_handle, const IteratorFromStringHandle::Attrs& |
129 | attrs); |
130 | operator ::tensorflow::Output() const { return resource_handle; } |
131 | operator ::tensorflow::Input() const { return resource_handle; } |
132 | ::tensorflow::Node* node() const { return resource_handle.node(); } |
133 | |
134 | static Attrs OutputTypes(const DataTypeSlice& x) { |
135 | return Attrs().OutputTypes(x); |
136 | } |
137 | static Attrs OutputShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
138 | return Attrs().OutputShapes(x); |
139 | } |
140 | |
141 | Operation operation; |
142 | ::tensorflow::Output resource_handle; |
143 | }; |
144 | |
145 | /// Gets the next output from the given iterator . |
146 | /// |
147 | /// Args: |
148 | /// * scope: A Scope object |
149 | /// |
150 | /// Returns: |
151 | /// * `OutputList`: The components tensor. |
152 | class IteratorGetNext { |
153 | public: |
154 | IteratorGetNext(const ::tensorflow::Scope& scope, ::tensorflow::Input iterator, |
155 | const DataTypeSlice& output_types, const |
156 | gtl::ArraySlice<PartialTensorShape>& output_shapes); |
157 | ::tensorflow::Output operator[](size_t index) const { return components[index]; } |
158 | |
159 | |
160 | Operation operation; |
161 | ::tensorflow::OutputList components; |
162 | }; |
163 | |
164 | /// Gets the next output from the given iterator as an Optional variant. |
165 | /// |
166 | /// Args: |
167 | /// * scope: A Scope object |
168 | /// |
169 | /// Returns: |
170 | /// * `Output`: The optional tensor. |
171 | class IteratorGetNextAsOptional { |
172 | public: |
173 | IteratorGetNextAsOptional(const ::tensorflow::Scope& scope, ::tensorflow::Input |
174 | iterator, const DataTypeSlice& output_types, const |
175 | gtl::ArraySlice<PartialTensorShape>& output_shapes); |
176 | operator ::tensorflow::Output() const { return optional; } |
177 | operator ::tensorflow::Input() const { return optional; } |
178 | ::tensorflow::Node* node() const { return optional.node(); } |
179 | |
180 | Operation operation; |
181 | ::tensorflow::Output optional; |
182 | }; |
183 | |
184 | /// Gets the next output from the given iterator. |
185 | /// |
186 | /// This operation is a synchronous version IteratorGetNext. It should only be used |
187 | /// in situations where the iterator does not block the calling thread, or where |
188 | /// the calling thread is not a member of the thread pool used to execute parallel |
189 | /// operations (e.g. in eager mode). |
190 | /// |
191 | /// Args: |
192 | /// * scope: A Scope object |
193 | /// |
194 | /// Returns: |
195 | /// * `OutputList`: The components tensor. |
196 | class IteratorGetNextSync { |
197 | public: |
198 | IteratorGetNextSync(const ::tensorflow::Scope& scope, ::tensorflow::Input |
199 | iterator, const DataTypeSlice& output_types, const |
200 | gtl::ArraySlice<PartialTensorShape>& output_shapes); |
201 | ::tensorflow::Output operator[](size_t index) const { return components[index]; } |
202 | |
203 | |
204 | Operation operation; |
205 | ::tensorflow::OutputList components; |
206 | }; |
207 | |
208 | /// Converts the given `resource_handle` representing an iterator to a string. |
209 | /// |
210 | /// Args: |
211 | /// * scope: A Scope object |
212 | /// * resource_handle: A handle to an iterator resource. |
213 | /// |
214 | /// Returns: |
215 | /// * `Output`: A string representation of the given handle. |
216 | class IteratorToStringHandle { |
217 | public: |
218 | IteratorToStringHandle(const ::tensorflow::Scope& scope, ::tensorflow::Input |
219 | resource_handle); |
220 | operator ::tensorflow::Output() const { return string_handle; } |
221 | operator ::tensorflow::Input() const { return string_handle; } |
222 | ::tensorflow::Node* node() const { return string_handle.node(); } |
223 | |
224 | Operation operation; |
225 | ::tensorflow::Output string_handle; |
226 | }; |
227 | |
228 | /// Makes a new iterator from the given `dataset` and stores it in `iterator`. |
229 | /// |
230 | /// This operation may be executed multiple times. Each execution will reset the |
231 | /// iterator in `iterator` to the first element of `dataset`. |
232 | /// |
233 | /// Args: |
234 | /// * scope: A Scope object |
235 | /// |
236 | /// Returns: |
237 | /// * the created `Operation` |
238 | class MakeIterator { |
239 | public: |
240 | MakeIterator(const ::tensorflow::Scope& scope, ::tensorflow::Input dataset, |
241 | ::tensorflow::Input iterator); |
242 | operator ::tensorflow::Operation() const { return operation; } |
243 | |
244 | Operation operation; |
245 | }; |
246 | |
247 | /// Makes a "one-shot" iterator that can be iterated only once. |
248 | /// |
249 | /// A one-shot iterator bundles the logic for defining the dataset and |
250 | /// the state of the iterator in a single op, which allows simple input |
251 | /// pipelines to be defined without an additional initialization |
252 | /// ("MakeIterator") step. |
253 | /// |
254 | /// One-shot iterators have the following limitations: |
255 | /// |
256 | /// * They do not support parameterization: all logic for creating the underlying |
257 | /// dataset must be bundled in the `dataset_factory` function. |
258 | /// * They are not resettable. Once a one-shot iterator reaches the end of its |
259 | /// underlying dataset, subsequent "IteratorGetNext" operations on that |
260 | /// iterator will always produce an `OutOfRange` error. |
261 | /// |
262 | /// For greater flexibility, use "Iterator" and "MakeIterator" to define |
263 | /// an iterator using an arbitrary subgraph, which may capture tensors |
264 | /// (including fed values) as parameters, and which may be reset multiple |
265 | /// times by rerunning "MakeIterator". |
266 | /// |
267 | /// Args: |
268 | /// * scope: A Scope object |
269 | /// * dataset_factory: A function of type `() -> DT_VARIANT`, where the returned |
270 | /// DT_VARIANT is a dataset. |
271 | /// |
272 | /// Returns: |
273 | /// * `Output`: A handle to the iterator that can be passed to an "IteratorGetNext" |
274 | /// op. |
275 | class OneShotIterator { |
276 | public: |
277 | /// Optional attribute setters for OneShotIterator |
278 | struct Attrs { |
279 | /// Defaults to "" |
280 | TF_MUST_USE_RESULT Attrs Container(StringPiece x) { |
281 | Attrs ret = *this; |
282 | ret.container_ = x; |
283 | return ret; |
284 | } |
285 | |
286 | /// Defaults to "" |
287 | TF_MUST_USE_RESULT Attrs SharedName(StringPiece x) { |
288 | Attrs ret = *this; |
289 | ret.shared_name_ = x; |
290 | return ret; |
291 | } |
292 | |
293 | StringPiece container_ = "" ; |
294 | StringPiece shared_name_ = "" ; |
295 | }; |
296 | OneShotIterator(const ::tensorflow::Scope& scope, const NameAttrList& |
297 | dataset_factory, const DataTypeSlice& output_types, const |
298 | gtl::ArraySlice<PartialTensorShape>& output_shapes); |
299 | OneShotIterator(const ::tensorflow::Scope& scope, const NameAttrList& |
300 | dataset_factory, const DataTypeSlice& output_types, const |
301 | gtl::ArraySlice<PartialTensorShape>& output_shapes, const |
302 | OneShotIterator::Attrs& attrs); |
303 | operator ::tensorflow::Output() const { return handle; } |
304 | operator ::tensorflow::Input() const { return handle; } |
305 | ::tensorflow::Node* node() const { return handle.node(); } |
306 | |
307 | static Attrs Container(StringPiece x) { |
308 | return Attrs().Container(x); |
309 | } |
310 | static Attrs SharedName(StringPiece x) { |
311 | return Attrs().SharedName(x); |
312 | } |
313 | |
314 | Operation operation; |
315 | ::tensorflow::Output handle; |
316 | }; |
317 | |
318 | /// Constructs an Optional variant from a tuple of tensors. |
319 | /// |
320 | /// Args: |
321 | /// * scope: A Scope object |
322 | /// |
323 | /// Returns: |
324 | /// * `Output`: The optional tensor. |
325 | class OptionalFromValue { |
326 | public: |
327 | OptionalFromValue(const ::tensorflow::Scope& scope, ::tensorflow::InputList |
328 | components); |
329 | operator ::tensorflow::Output() const { return optional; } |
330 | operator ::tensorflow::Input() const { return optional; } |
331 | ::tensorflow::Node* node() const { return optional.node(); } |
332 | |
333 | Operation operation; |
334 | ::tensorflow::Output optional; |
335 | }; |
336 | |
337 | /// Returns the value stored in an Optional variant or raises an error if none exists. |
338 | /// |
339 | /// Args: |
340 | /// * scope: A Scope object |
341 | /// |
342 | /// Returns: |
343 | /// * `OutputList`: The components tensor. |
344 | class OptionalGetValue { |
345 | public: |
346 | OptionalGetValue(const ::tensorflow::Scope& scope, ::tensorflow::Input |
347 | optional, const DataTypeSlice& output_types, const |
348 | gtl::ArraySlice<PartialTensorShape>& output_shapes); |
349 | ::tensorflow::Output operator[](size_t index) const { return components[index]; } |
350 | |
351 | |
352 | Operation operation; |
353 | ::tensorflow::OutputList components; |
354 | }; |
355 | |
356 | /// Returns true if and only if the given Optional variant has a value. |
357 | /// |
358 | /// Args: |
359 | /// * scope: A Scope object |
360 | /// |
361 | /// Returns: |
362 | /// * `Output`: The has_value tensor. |
363 | class OptionalHasValue { |
364 | public: |
365 | OptionalHasValue(const ::tensorflow::Scope& scope, ::tensorflow::Input |
366 | optional); |
367 | operator ::tensorflow::Output() const { return has_value; } |
368 | operator ::tensorflow::Input() const { return has_value; } |
369 | ::tensorflow::Node* node() const { return has_value.node(); } |
370 | |
371 | Operation operation; |
372 | ::tensorflow::Output has_value; |
373 | }; |
374 | |
375 | /// Creates an Optional variant with no value. |
376 | /// |
377 | /// Args: |
378 | /// * scope: A Scope object |
379 | /// |
380 | /// Returns: |
381 | /// * `Output`: The optional tensor. |
382 | class OptionalNone { |
383 | public: |
384 | OptionalNone(const ::tensorflow::Scope& scope); |
385 | operator ::tensorflow::Output() const { return optional; } |
386 | operator ::tensorflow::Input() const { return optional; } |
387 | ::tensorflow::Node* node() const { return optional.node(); } |
388 | |
389 | Operation operation; |
390 | ::tensorflow::Output optional; |
391 | }; |
392 | |
393 | /// Converts the given `resource_handle` representing an iterator to a variant tensor. |
394 | /// |
395 | /// Args: |
396 | /// * scope: A Scope object |
397 | /// * resource_handle: A handle to an iterator resource. |
398 | /// |
399 | /// Returns: |
400 | /// * `Output`: A variant tensor storing the state of the iterator contained in the |
401 | /// resource. |
402 | class SerializeIterator { |
403 | public: |
404 | /// Optional attribute setters for SerializeIterator |
405 | struct Attrs { |
406 | /// Defaults to 0 |
407 | TF_MUST_USE_RESULT Attrs ExternalStatePolicy(int64 x) { |
408 | Attrs ret = *this; |
409 | ret.external_state_policy_ = x; |
410 | return ret; |
411 | } |
412 | |
413 | int64 external_state_policy_ = 0; |
414 | }; |
415 | SerializeIterator(const ::tensorflow::Scope& scope, ::tensorflow::Input |
416 | resource_handle); |
417 | SerializeIterator(const ::tensorflow::Scope& scope, ::tensorflow::Input |
418 | resource_handle, const SerializeIterator::Attrs& attrs); |
419 | operator ::tensorflow::Output() const { return serialized; } |
420 | operator ::tensorflow::Input() const { return serialized; } |
421 | ::tensorflow::Node* node() const { return serialized.node(); } |
422 | |
423 | static Attrs ExternalStatePolicy(int64 x) { |
424 | return Attrs().ExternalStatePolicy(x); |
425 | } |
426 | |
427 | Operation operation; |
428 | ::tensorflow::Output serialized; |
429 | }; |
430 | |
431 | /// @} |
432 | |
433 | } // namespace ops |
434 | } // namespace tensorflow |
435 | |
436 | #endif // TENSORFLOW_CC_OPS_DATASET_OPS_H_ |
437 | |