1 | // This file is MACHINE GENERATED! Do not edit. |
2 | |
3 | #ifndef TENSORFLOW_CC_OPS_PARSING_OPS_H_ |
4 | #define TENSORFLOW_CC_OPS_PARSING_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 parsing_ops Parsing Ops |
19 | /// @{ |
20 | |
21 | /// Convert CSV records to tensors. Each column maps to one tensor. |
22 | /// |
23 | /// RFC 4180 format is expected for the CSV records. |
24 | /// (https://tools.ietf.org/html/rfc4180) |
25 | /// Note that we allow leading and trailing spaces with int or float field. |
26 | /// |
27 | /// Args: |
28 | /// * scope: A Scope object |
29 | /// * records: Each string is a record/row in the csv and all records should have |
30 | /// the same format. |
31 | /// * record_defaults: One tensor per column of the input record, with either a |
32 | /// scalar default value for that column or an empty vector if the column is |
33 | /// required. |
34 | /// |
35 | /// Optional attributes (see `Attrs`): |
36 | /// * field_delim: char delimiter to separate fields in a record. |
37 | /// * use_quote_delim: If false, treats double quotation marks as regular |
38 | /// characters inside of the string fields (ignoring RFC 4180, Section 2, |
39 | /// Bullet 5). |
40 | /// * na_value: Additional string to recognize as NA/NaN. |
41 | /// |
42 | /// Returns: |
43 | /// * `OutputList`: Each tensor will have the same shape as records. |
44 | class DecodeCSV { |
45 | public: |
46 | /// Optional attribute setters for DecodeCSV |
47 | struct Attrs { |
48 | /// char delimiter to separate fields in a record. |
49 | /// |
50 | /// Defaults to "," |
51 | TF_MUST_USE_RESULT Attrs FieldDelim(StringPiece x) { |
52 | Attrs ret = *this; |
53 | ret.field_delim_ = x; |
54 | return ret; |
55 | } |
56 | |
57 | /// If false, treats double quotation marks as regular |
58 | /// characters inside of the string fields (ignoring RFC 4180, Section 2, |
59 | /// Bullet 5). |
60 | /// |
61 | /// Defaults to true |
62 | TF_MUST_USE_RESULT Attrs UseQuoteDelim(bool x) { |
63 | Attrs ret = *this; |
64 | ret.use_quote_delim_ = x; |
65 | return ret; |
66 | } |
67 | |
68 | /// Additional string to recognize as NA/NaN. |
69 | /// |
70 | /// Defaults to "" |
71 | TF_MUST_USE_RESULT Attrs NaValue(StringPiece x) { |
72 | Attrs ret = *this; |
73 | ret.na_value_ = x; |
74 | return ret; |
75 | } |
76 | |
77 | /// Defaults to [] |
78 | TF_MUST_USE_RESULT Attrs SelectCols(const gtl::ArraySlice<int>& x) { |
79 | Attrs ret = *this; |
80 | ret.select_cols_ = x; |
81 | return ret; |
82 | } |
83 | |
84 | StringPiece field_delim_ = "," ; |
85 | bool use_quote_delim_ = true; |
86 | StringPiece na_value_ = "" ; |
87 | gtl::ArraySlice<int> select_cols_ = {}; |
88 | }; |
89 | DecodeCSV(const ::tensorflow::Scope& scope, ::tensorflow::Input records, |
90 | ::tensorflow::InputList record_defaults); |
91 | DecodeCSV(const ::tensorflow::Scope& scope, ::tensorflow::Input records, |
92 | ::tensorflow::InputList record_defaults, const DecodeCSV::Attrs& |
93 | attrs); |
94 | ::tensorflow::Output operator[](size_t index) const { return output[index]; } |
95 | |
96 | |
97 | static Attrs FieldDelim(StringPiece x) { |
98 | return Attrs().FieldDelim(x); |
99 | } |
100 | static Attrs UseQuoteDelim(bool x) { |
101 | return Attrs().UseQuoteDelim(x); |
102 | } |
103 | static Attrs NaValue(StringPiece x) { |
104 | return Attrs().NaValue(x); |
105 | } |
106 | static Attrs SelectCols(const gtl::ArraySlice<int>& x) { |
107 | return Attrs().SelectCols(x); |
108 | } |
109 | |
110 | Operation operation; |
111 | ::tensorflow::OutputList output; |
112 | }; |
113 | |
114 | /// Decompress strings. |
115 | /// |
116 | /// This op decompresses each element of the `bytes` input `Tensor`, which |
117 | /// is assumed to be compressed using the given `compression_type`. |
118 | /// |
119 | /// The `output` is a string `Tensor` of the same shape as `bytes`, |
120 | /// each element containing the decompressed data from the corresponding |
121 | /// element in `bytes`. |
122 | /// |
123 | /// Args: |
124 | /// * scope: A Scope object |
125 | /// * bytes: A Tensor of string which is compressed. |
126 | /// |
127 | /// Optional attributes (see `Attrs`): |
128 | /// * compression_type: A scalar containing either (i) the empty string (no |
129 | /// compression), (ii) "ZLIB", or (iii) "GZIP". |
130 | /// |
131 | /// Returns: |
132 | /// * `Output`: A Tensor with the same shape as input `bytes`, uncompressed |
133 | /// from bytes. |
134 | class DecodeCompressed { |
135 | public: |
136 | /// Optional attribute setters for DecodeCompressed |
137 | struct Attrs { |
138 | /// A scalar containing either (i) the empty string (no |
139 | /// compression), (ii) "ZLIB", or (iii) "GZIP". |
140 | /// |
141 | /// Defaults to "" |
142 | TF_MUST_USE_RESULT Attrs CompressionType(StringPiece x) { |
143 | Attrs ret = *this; |
144 | ret.compression_type_ = x; |
145 | return ret; |
146 | } |
147 | |
148 | StringPiece compression_type_ = "" ; |
149 | }; |
150 | DecodeCompressed(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes); |
151 | DecodeCompressed(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes, |
152 | const DecodeCompressed::Attrs& attrs); |
153 | operator ::tensorflow::Output() const { return output; } |
154 | operator ::tensorflow::Input() const { return output; } |
155 | ::tensorflow::Node* node() const { return output.node(); } |
156 | |
157 | static Attrs CompressionType(StringPiece x) { |
158 | return Attrs().CompressionType(x); |
159 | } |
160 | |
161 | Operation operation; |
162 | ::tensorflow::Output output; |
163 | }; |
164 | |
165 | /// Convert JSON-encoded Example records to binary protocol buffer strings. |
166 | /// |
167 | /// |
168 | /// Note: This is **not** a general purpose JSON parsing op. |
169 | /// |
170 | /// This op converts JSON-serialized |
171 | /// `tf.train.Example` (created with `json_format.MessageToJson`, following the |
172 | /// [standard JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json)) |
173 | /// to a binary-serialized `tf.train.Example` (equivalent to |
174 | /// `Example.SerializeToString()`) suitable for conversion to tensors with |
175 | /// `tf.io.parse_example`. |
176 | /// |
177 | /// Args: |
178 | /// * scope: A Scope object |
179 | /// * json_examples: Each string is a JSON object serialized according to the JSON |
180 | /// mapping of the Example proto. |
181 | /// |
182 | /// Returns: |
183 | /// * `Output`: Each string is a binary Example protocol buffer corresponding |
184 | /// to the respective element of `json_examples`. |
185 | class DecodeJSONExample { |
186 | public: |
187 | DecodeJSONExample(const ::tensorflow::Scope& scope, ::tensorflow::Input |
188 | json_examples); |
189 | operator ::tensorflow::Output() const { return binary_examples; } |
190 | operator ::tensorflow::Input() const { return binary_examples; } |
191 | ::tensorflow::Node* node() const { return binary_examples.node(); } |
192 | |
193 | Operation operation; |
194 | ::tensorflow::Output binary_examples; |
195 | }; |
196 | |
197 | /// Reinterpret the bytes of a string as a vector of numbers. |
198 | /// |
199 | /// Args: |
200 | /// * scope: A Scope object |
201 | /// * input_bytes: Tensor of string to be decoded. |
202 | /// * fixed_length: Length in bytes for each element of the decoded output. Must be a multiple |
203 | /// of the size of the output type. |
204 | /// |
205 | /// Optional attributes (see `Attrs`): |
206 | /// * little_endian: Whether the input `input_bytes` is in little-endian order. Ignored for |
207 | /// `out_type` values that are stored in a single byte, like `uint8` |
208 | /// |
209 | /// Returns: |
210 | /// * `Output`: A Tensor with one more dimension than the input `bytes`. The added dimension |
211 | /// will have size equal to the length of the elements of `bytes` divided by the |
212 | /// number of bytes to represent `out_type`. |
213 | class DecodePaddedRaw { |
214 | public: |
215 | /// Optional attribute setters for DecodePaddedRaw |
216 | struct Attrs { |
217 | /// Whether the input `input_bytes` is in little-endian order. Ignored for |
218 | /// `out_type` values that are stored in a single byte, like `uint8` |
219 | /// |
220 | /// Defaults to true |
221 | TF_MUST_USE_RESULT Attrs LittleEndian(bool x) { |
222 | Attrs ret = *this; |
223 | ret.little_endian_ = x; |
224 | return ret; |
225 | } |
226 | |
227 | bool little_endian_ = true; |
228 | }; |
229 | DecodePaddedRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input |
230 | input_bytes, ::tensorflow::Input fixed_length, DataType |
231 | out_type); |
232 | DecodePaddedRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input |
233 | input_bytes, ::tensorflow::Input fixed_length, DataType |
234 | out_type, const DecodePaddedRaw::Attrs& attrs); |
235 | operator ::tensorflow::Output() const { return output; } |
236 | operator ::tensorflow::Input() const { return output; } |
237 | ::tensorflow::Node* node() const { return output.node(); } |
238 | |
239 | static Attrs LittleEndian(bool x) { |
240 | return Attrs().LittleEndian(x); |
241 | } |
242 | |
243 | Operation operation; |
244 | ::tensorflow::Output output; |
245 | }; |
246 | |
247 | /// Reinterpret the bytes of a string as a vector of numbers. |
248 | /// |
249 | /// Args: |
250 | /// * scope: A Scope object |
251 | /// * bytes: All the elements must have the same length. |
252 | /// |
253 | /// Optional attributes (see `Attrs`): |
254 | /// * little_endian: Whether the input `bytes` are in little-endian order. |
255 | /// Ignored for `out_type` values that are stored in a single byte like |
256 | /// `uint8`. |
257 | /// |
258 | /// Returns: |
259 | /// * `Output`: A Tensor with one more dimension than the input `bytes`. The |
260 | /// added dimension will have size equal to the length of the elements |
261 | /// of `bytes` divided by the number of bytes to represent `out_type`. |
262 | class DecodeRaw { |
263 | public: |
264 | /// Optional attribute setters for DecodeRaw |
265 | struct Attrs { |
266 | /// Whether the input `bytes` are in little-endian order. |
267 | /// Ignored for `out_type` values that are stored in a single byte like |
268 | /// `uint8`. |
269 | /// |
270 | /// Defaults to true |
271 | TF_MUST_USE_RESULT Attrs LittleEndian(bool x) { |
272 | Attrs ret = *this; |
273 | ret.little_endian_ = x; |
274 | return ret; |
275 | } |
276 | |
277 | bool little_endian_ = true; |
278 | }; |
279 | DecodeRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes, DataType |
280 | out_type); |
281 | DecodeRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes, DataType |
282 | out_type, const DecodeRaw::Attrs& attrs); |
283 | operator ::tensorflow::Output() const { return output; } |
284 | operator ::tensorflow::Input() const { return output; } |
285 | ::tensorflow::Node* node() const { return output.node(); } |
286 | |
287 | static Attrs LittleEndian(bool x) { |
288 | return Attrs().LittleEndian(x); |
289 | } |
290 | |
291 | Operation operation; |
292 | ::tensorflow::Output output; |
293 | }; |
294 | |
295 | /// Transforms a vector of brain.Example protos (as strings) into typed tensors. |
296 | /// |
297 | /// Args: |
298 | /// * scope: A Scope object |
299 | /// * serialized: A vector containing a batch of binary serialized Example protos. |
300 | /// * names: A vector containing the names of the serialized protos. |
301 | /// May contain, for example, table key (descriptive) names for the |
302 | /// corresponding serialized protos. These are purely useful for debugging |
303 | /// purposes, and the presence of values here has no effect on the output. |
304 | /// May also be an empty vector if no names are available. |
305 | /// If non-empty, this vector must be the same length as "serialized". |
306 | /// * sparse_keys: A list of Nsparse string Tensors (scalars). |
307 | /// The keys expected in the Examples' features associated with sparse values. |
308 | /// * dense_keys: A list of Ndense string Tensors (scalars). |
309 | /// The keys expected in the Examples' features associated with dense values. |
310 | /// * dense_defaults: A list of Ndense Tensors (some may be empty). |
311 | /// dense_defaults[j] provides default values |
312 | /// when the example's feature_map lacks dense_key[j]. If an empty Tensor is |
313 | /// provided for dense_defaults[j], then the Feature dense_keys[j] is required. |
314 | /// The input type is inferred from dense_defaults[j], even when it's empty. |
315 | /// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, |
316 | /// then the shape of dense_defaults[j] must match that of dense_shapes[j]. |
317 | /// If dense_shapes[j] has an undefined major dimension (variable strides dense |
318 | /// feature), dense_defaults[j] must contain a single element: |
319 | /// the padding element. |
320 | /// * sparse_types: A list of Nsparse types; the data types of data in each Feature |
321 | /// given in sparse_keys. |
322 | /// Currently the ParseExample supports DT_FLOAT (FloatList), |
323 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
324 | /// * dense_shapes: A list of Ndense shapes; the shapes of data in each Feature |
325 | /// given in dense_keys. |
326 | /// The number of elements in the Feature corresponding to dense_key[j] |
327 | /// must always equal dense_shapes[j].NumEntries(). |
328 | /// If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output |
329 | /// Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): |
330 | /// The dense outputs are just the inputs row-stacked by batch. |
331 | /// This works for dense_shapes[j] = (-1, D1, ..., DN). In this case |
332 | /// the shape of the output Tensor dense_values[j] will be |
333 | /// (|serialized|, M, D1, .., DN), where M is the maximum number of blocks |
334 | /// of elements of length D1 * .... * DN, across all minibatch entries |
335 | /// in the input. Any minibatch entry with less than M blocks of elements of |
336 | /// length D1 * ... * DN will be padded with the corresponding default_value |
337 | /// scalar element along the second dimension. |
338 | /// |
339 | /// Returns: |
340 | /// * `OutputList` sparse_indices |
341 | /// * `OutputList` sparse_values |
342 | /// * `OutputList` sparse_shapes |
343 | /// * `OutputList` dense_values |
344 | class ParseExample { |
345 | public: |
346 | ParseExample(const ::tensorflow::Scope& scope, ::tensorflow::Input serialized, |
347 | ::tensorflow::Input names, ::tensorflow::InputList sparse_keys, |
348 | ::tensorflow::InputList dense_keys, ::tensorflow::InputList |
349 | dense_defaults, const DataTypeSlice& sparse_types, const |
350 | gtl::ArraySlice<PartialTensorShape>& dense_shapes); |
351 | |
352 | Operation operation; |
353 | ::tensorflow::OutputList sparse_indices; |
354 | ::tensorflow::OutputList sparse_values; |
355 | ::tensorflow::OutputList sparse_shapes; |
356 | ::tensorflow::OutputList dense_values; |
357 | }; |
358 | |
359 | /// Transforms a vector of tf.Example protos (as strings) into typed tensors. |
360 | /// |
361 | /// Args: |
362 | /// * scope: A Scope object |
363 | /// * serialized: A scalar or vector containing binary serialized Example protos. |
364 | /// * names: A tensor containing the names of the serialized protos. |
365 | /// Corresponds 1:1 with the `serialized` tensor. |
366 | /// May contain, for example, table key (descriptive) names for the |
367 | /// corresponding serialized protos. These are purely useful for debugging |
368 | /// purposes, and the presence of values here has no effect on the output. |
369 | /// May also be an empty vector if no names are available. |
370 | /// If non-empty, this tensor must have the same shape as "serialized". |
371 | /// * sparse_keys: Vector of strings. |
372 | /// The keys expected in the Examples' features associated with sparse values. |
373 | /// * dense_keys: Vector of strings. |
374 | /// The keys expected in the Examples' features associated with dense values. |
375 | /// * ragged_keys: Vector of strings. |
376 | /// The keys expected in the Examples' features associated with ragged values. |
377 | /// * dense_defaults: A list of Tensors (some may be empty). Corresponds 1:1 with `dense_keys`. |
378 | /// dense_defaults[j] provides default values |
379 | /// when the example's feature_map lacks dense_key[j]. If an empty Tensor is |
380 | /// provided for dense_defaults[j], then the Feature dense_keys[j] is required. |
381 | /// The input type is inferred from dense_defaults[j], even when it's empty. |
382 | /// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, |
383 | /// then the shape of dense_defaults[j] must match that of dense_shapes[j]. |
384 | /// If dense_shapes[j] has an undefined major dimension (variable strides dense |
385 | /// feature), dense_defaults[j] must contain a single element: |
386 | /// the padding element. |
387 | /// * num_sparse: The number of sparse keys. |
388 | /// * sparse_types: A list of `num_sparse` types; the data types of data in each Feature |
389 | /// given in sparse_keys. |
390 | /// Currently the ParseExample supports DT_FLOAT (FloatList), |
391 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
392 | /// * ragged_value_types: A list of `num_ragged` types; the data types of data in each Feature |
393 | /// given in ragged_keys (where `num_ragged = sparse_keys.size()`). |
394 | /// Currently the ParseExample supports DT_FLOAT (FloatList), |
395 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
396 | /// * ragged_split_types: A list of `num_ragged` types; the data types of row_splits in each Feature |
397 | /// given in ragged_keys (where `num_ragged = sparse_keys.size()`). |
398 | /// May be DT_INT32 or DT_INT64. |
399 | /// * dense_shapes: A list of `num_dense` shapes; the shapes of data in each Feature |
400 | /// given in dense_keys (where `num_dense = dense_keys.size()`). |
401 | /// The number of elements in the Feature corresponding to dense_key[j] |
402 | /// must always equal dense_shapes[j].NumEntries(). |
403 | /// If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output |
404 | /// Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): |
405 | /// The dense outputs are just the inputs row-stacked by batch. |
406 | /// This works for dense_shapes[j] = (-1, D1, ..., DN). In this case |
407 | /// the shape of the output Tensor dense_values[j] will be |
408 | /// (|serialized|, M, D1, .., DN), where M is the maximum number of blocks |
409 | /// of elements of length D1 * .... * DN, across all minibatch entries |
410 | /// in the input. Any minibatch entry with less than M blocks of elements of |
411 | /// length D1 * ... * DN will be padded with the corresponding default_value |
412 | /// scalar element along the second dimension. |
413 | /// |
414 | /// Returns: |
415 | /// * `OutputList` sparse_indices |
416 | /// * `OutputList` sparse_values |
417 | /// * `OutputList` sparse_shapes |
418 | /// * `OutputList` dense_values |
419 | /// * `OutputList` ragged_values |
420 | /// * `OutputList` ragged_row_splits |
421 | class ParseExampleV2 { |
422 | public: |
423 | ParseExampleV2(const ::tensorflow::Scope& scope, ::tensorflow::Input |
424 | serialized, ::tensorflow::Input names, ::tensorflow::Input |
425 | sparse_keys, ::tensorflow::Input dense_keys, ::tensorflow::Input |
426 | ragged_keys, ::tensorflow::InputList dense_defaults, int64 |
427 | num_sparse, const DataTypeSlice& sparse_types, const |
428 | DataTypeSlice& ragged_value_types, const DataTypeSlice& |
429 | ragged_split_types, const gtl::ArraySlice<PartialTensorShape>& |
430 | dense_shapes); |
431 | |
432 | Operation operation; |
433 | ::tensorflow::OutputList sparse_indices; |
434 | ::tensorflow::OutputList sparse_values; |
435 | ::tensorflow::OutputList sparse_shapes; |
436 | ::tensorflow::OutputList dense_values; |
437 | ::tensorflow::OutputList ragged_values; |
438 | ::tensorflow::OutputList ragged_row_splits; |
439 | }; |
440 | |
441 | /// Transforms a vector of brain.SequenceExample protos (as strings) into typed tensors. |
442 | /// |
443 | /// Args: |
444 | /// * scope: A Scope object |
445 | /// * serialized: A vector containing binary serialized SequenceExample protos. |
446 | /// * debug_name: A vector containing the names of the serialized protos. |
447 | /// May contain, for example, table key (descriptive) name for the |
448 | /// corresponding serialized proto. This is purely useful for debugging |
449 | /// purposes, and the presence of values here has no effect on the output. |
450 | /// May also be an empty vector if no name is available. |
451 | /// * context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). |
452 | /// context_dense_defaults[j] provides default values |
453 | /// when the SequenceExample's context map lacks context_dense_key[j]. |
454 | /// If an empty Tensor is provided for context_dense_defaults[j], |
455 | /// then the Feature context_dense_keys[j] is required. |
456 | /// The input type is inferred from context_dense_defaults[j], even when it's |
457 | /// empty. If context_dense_defaults[j] is not empty, its shape must match |
458 | /// context_dense_shapes[j]. |
459 | /// * feature_list_dense_missing_assumed_empty: A vector listing the |
460 | /// FeatureList keys which may be missing from the SequenceExamples. If the |
461 | /// associated FeatureList is missing, it is treated as empty. By default, |
462 | /// any FeatureList not listed in this vector must exist in the SequenceExamples. |
463 | /// * context_sparse_keys: A list of Ncontext_sparse string Tensors (scalars). |
464 | /// The keys expected in the Examples' features associated with context_sparse |
465 | /// values. |
466 | /// * context_dense_keys: A list of Ncontext_dense string Tensors (scalars). |
467 | /// The keys expected in the SequenceExamples' context features associated with |
468 | /// dense values. |
469 | /// * feature_list_sparse_keys: A list of Nfeature_list_sparse string Tensors |
470 | /// (scalars). The keys expected in the FeatureLists associated with sparse |
471 | /// values. |
472 | /// * feature_list_dense_keys: A list of Nfeature_list_dense string Tensors (scalars). |
473 | /// The keys expected in the SequenceExamples' feature_lists associated |
474 | /// with lists of dense values. |
475 | /// |
476 | /// Optional attributes (see `Attrs`): |
477 | /// * context_sparse_types: A list of Ncontext_sparse types; the data types of data in |
478 | /// each context Feature given in context_sparse_keys. |
479 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
480 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
481 | /// * context_dense_shapes: A list of Ncontext_dense shapes; the shapes of data in |
482 | /// each context Feature given in context_dense_keys. |
483 | /// The number of elements in the Feature corresponding to context_dense_key[j] |
484 | /// must always equal context_dense_shapes[j].NumEntries(). |
485 | /// The shape of context_dense_values[j] will match context_dense_shapes[j]. |
486 | /// * feature_list_sparse_types: A list of Nfeature_list_sparse types; the data types |
487 | /// of data in each FeatureList given in feature_list_sparse_keys. |
488 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
489 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
490 | /// * feature_list_dense_shapes: A list of Nfeature_list_dense shapes; the shapes of |
491 | /// data in each FeatureList given in feature_list_dense_keys. |
492 | /// The shape of each Feature in the FeatureList corresponding to |
493 | /// feature_list_dense_key[j] must always equal |
494 | /// feature_list_dense_shapes[j].NumEntries(). |
495 | /// |
496 | /// Returns: |
497 | /// * `OutputList` context_sparse_indices |
498 | /// * `OutputList` context_sparse_values |
499 | /// * `OutputList` context_sparse_shapes |
500 | /// * `OutputList` context_dense_values |
501 | /// * `OutputList` feature_list_sparse_indices |
502 | /// * `OutputList` feature_list_sparse_values |
503 | /// * `OutputList` feature_list_sparse_shapes |
504 | /// * `OutputList` feature_list_dense_values |
505 | /// * `OutputList` feature_list_dense_lengths |
506 | class ParseSequenceExample { |
507 | public: |
508 | /// Optional attribute setters for ParseSequenceExample |
509 | struct Attrs { |
510 | /// Defaults to 0 |
511 | TF_MUST_USE_RESULT Attrs NcontextSparse(int64 x) { |
512 | Attrs ret = *this; |
513 | ret.Ncontext_sparse_ = x; |
514 | return ret; |
515 | } |
516 | |
517 | /// Defaults to 0 |
518 | TF_MUST_USE_RESULT Attrs NcontextDense(int64 x) { |
519 | Attrs ret = *this; |
520 | ret.Ncontext_dense_ = x; |
521 | return ret; |
522 | } |
523 | |
524 | /// Defaults to 0 |
525 | TF_MUST_USE_RESULT Attrs NfeatureListSparse(int64 x) { |
526 | Attrs ret = *this; |
527 | ret.Nfeature_list_sparse_ = x; |
528 | return ret; |
529 | } |
530 | |
531 | /// Defaults to 0 |
532 | TF_MUST_USE_RESULT Attrs NfeatureListDense(int64 x) { |
533 | Attrs ret = *this; |
534 | ret.Nfeature_list_dense_ = x; |
535 | return ret; |
536 | } |
537 | |
538 | /// A list of Ncontext_sparse types; the data types of data in |
539 | /// each context Feature given in context_sparse_keys. |
540 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
541 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
542 | /// |
543 | /// Defaults to [] |
544 | TF_MUST_USE_RESULT Attrs ContextSparseTypes(const DataTypeSlice& x) { |
545 | Attrs ret = *this; |
546 | ret.context_sparse_types_ = x; |
547 | return ret; |
548 | } |
549 | |
550 | /// Defaults to [] |
551 | TF_MUST_USE_RESULT Attrs FeatureListDenseTypes(const DataTypeSlice& x) { |
552 | Attrs ret = *this; |
553 | ret.feature_list_dense_types_ = x; |
554 | return ret; |
555 | } |
556 | |
557 | /// A list of Ncontext_dense shapes; the shapes of data in |
558 | /// each context Feature given in context_dense_keys. |
559 | /// The number of elements in the Feature corresponding to context_dense_key[j] |
560 | /// must always equal context_dense_shapes[j].NumEntries(). |
561 | /// The shape of context_dense_values[j] will match context_dense_shapes[j]. |
562 | /// |
563 | /// Defaults to [] |
564 | TF_MUST_USE_RESULT Attrs ContextDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
565 | Attrs ret = *this; |
566 | ret.context_dense_shapes_ = x; |
567 | return ret; |
568 | } |
569 | |
570 | /// A list of Nfeature_list_sparse types; the data types |
571 | /// of data in each FeatureList given in feature_list_sparse_keys. |
572 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
573 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
574 | /// |
575 | /// Defaults to [] |
576 | TF_MUST_USE_RESULT Attrs FeatureListSparseTypes(const DataTypeSlice& x) { |
577 | Attrs ret = *this; |
578 | ret.feature_list_sparse_types_ = x; |
579 | return ret; |
580 | } |
581 | |
582 | /// A list of Nfeature_list_dense shapes; the shapes of |
583 | /// data in each FeatureList given in feature_list_dense_keys. |
584 | /// The shape of each Feature in the FeatureList corresponding to |
585 | /// feature_list_dense_key[j] must always equal |
586 | /// feature_list_dense_shapes[j].NumEntries(). |
587 | /// |
588 | /// Defaults to [] |
589 | TF_MUST_USE_RESULT Attrs FeatureListDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
590 | Attrs ret = *this; |
591 | ret.feature_list_dense_shapes_ = x; |
592 | return ret; |
593 | } |
594 | |
595 | int64 Ncontext_sparse_ = 0; |
596 | int64 Ncontext_dense_ = 0; |
597 | int64 Nfeature_list_sparse_ = 0; |
598 | int64 Nfeature_list_dense_ = 0; |
599 | DataTypeSlice context_sparse_types_ = {}; |
600 | DataTypeSlice feature_list_dense_types_ = {}; |
601 | gtl::ArraySlice<PartialTensorShape> context_dense_shapes_ = {}; |
602 | DataTypeSlice feature_list_sparse_types_ = {}; |
603 | gtl::ArraySlice<PartialTensorShape> feature_list_dense_shapes_ = {}; |
604 | }; |
605 | ParseSequenceExample(const ::tensorflow::Scope& scope, ::tensorflow::Input |
606 | serialized, ::tensorflow::Input debug_name, |
607 | ::tensorflow::InputList context_dense_defaults, const |
608 | gtl::ArraySlice<::tensorflow::tstring>& |
609 | feature_list_dense_missing_assumed_empty, const |
610 | gtl::ArraySlice<::tensorflow::tstring>& |
611 | context_sparse_keys, const |
612 | gtl::ArraySlice<::tensorflow::tstring>& |
613 | context_dense_keys, const |
614 | gtl::ArraySlice<::tensorflow::tstring>& |
615 | feature_list_sparse_keys, const |
616 | gtl::ArraySlice<::tensorflow::tstring>& |
617 | feature_list_dense_keys); |
618 | ParseSequenceExample(const ::tensorflow::Scope& scope, ::tensorflow::Input |
619 | serialized, ::tensorflow::Input debug_name, |
620 | ::tensorflow::InputList context_dense_defaults, const |
621 | gtl::ArraySlice<::tensorflow::tstring>& |
622 | feature_list_dense_missing_assumed_empty, const |
623 | gtl::ArraySlice<::tensorflow::tstring>& |
624 | context_sparse_keys, const |
625 | gtl::ArraySlice<::tensorflow::tstring>& |
626 | context_dense_keys, const |
627 | gtl::ArraySlice<::tensorflow::tstring>& |
628 | feature_list_sparse_keys, const |
629 | gtl::ArraySlice<::tensorflow::tstring>& |
630 | feature_list_dense_keys, const |
631 | ParseSequenceExample::Attrs& attrs); |
632 | |
633 | static Attrs NcontextSparse(int64 x) { |
634 | return Attrs().NcontextSparse(x); |
635 | } |
636 | static Attrs NcontextDense(int64 x) { |
637 | return Attrs().NcontextDense(x); |
638 | } |
639 | static Attrs NfeatureListSparse(int64 x) { |
640 | return Attrs().NfeatureListSparse(x); |
641 | } |
642 | static Attrs NfeatureListDense(int64 x) { |
643 | return Attrs().NfeatureListDense(x); |
644 | } |
645 | static Attrs ContextSparseTypes(const DataTypeSlice& x) { |
646 | return Attrs().ContextSparseTypes(x); |
647 | } |
648 | static Attrs FeatureListDenseTypes(const DataTypeSlice& x) { |
649 | return Attrs().FeatureListDenseTypes(x); |
650 | } |
651 | static Attrs ContextDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
652 | return Attrs().ContextDenseShapes(x); |
653 | } |
654 | static Attrs FeatureListSparseTypes(const DataTypeSlice& x) { |
655 | return Attrs().FeatureListSparseTypes(x); |
656 | } |
657 | static Attrs FeatureListDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
658 | return Attrs().FeatureListDenseShapes(x); |
659 | } |
660 | |
661 | Operation operation; |
662 | ::tensorflow::OutputList context_sparse_indices; |
663 | ::tensorflow::OutputList context_sparse_values; |
664 | ::tensorflow::OutputList context_sparse_shapes; |
665 | ::tensorflow::OutputList context_dense_values; |
666 | ::tensorflow::OutputList feature_list_sparse_indices; |
667 | ::tensorflow::OutputList feature_list_sparse_values; |
668 | ::tensorflow::OutputList feature_list_sparse_shapes; |
669 | ::tensorflow::OutputList feature_list_dense_values; |
670 | ::tensorflow::OutputList feature_list_dense_lengths; |
671 | }; |
672 | |
673 | /// Transforms a vector of tf.io.SequenceExample protos (as strings) into |
674 | /// typed tensors. |
675 | /// |
676 | /// Args: |
677 | /// * scope: A Scope object |
678 | /// * serialized: A scalar or vector containing binary serialized SequenceExample protos. |
679 | /// * debug_name: A scalar or vector containing the names of the serialized protos. |
680 | /// May contain, for example, table key (descriptive) name for the |
681 | /// corresponding serialized proto. This is purely useful for debugging |
682 | /// purposes, and the presence of values here has no effect on the output. |
683 | /// May also be an empty vector if no name is available. |
684 | /// * context_sparse_keys: The keys expected in the Examples' features associated with context_sparse |
685 | /// values. |
686 | /// * context_dense_keys: The keys expected in the SequenceExamples' context features associated with |
687 | /// dense values. |
688 | /// * context_ragged_keys: The keys expected in the Examples' features associated with context_ragged |
689 | /// values. |
690 | /// * feature_list_sparse_keys: The keys expected in the FeatureLists associated with sparse values. |
691 | /// * feature_list_dense_keys: The keys expected in the SequenceExamples' feature_lists associated |
692 | /// with lists of dense values. |
693 | /// * feature_list_ragged_keys: The keys expected in the FeatureLists associated with ragged values. |
694 | /// * feature_list_dense_missing_assumed_empty: A vector corresponding 1:1 with feature_list_dense_keys, indicating which |
695 | /// features may be missing from the SequenceExamples. If the associated |
696 | /// FeatureList is missing, it is treated as empty. |
697 | /// * context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). |
698 | /// context_dense_defaults[j] provides default values |
699 | /// when the SequenceExample's context map lacks context_dense_key[j]. |
700 | /// If an empty Tensor is provided for context_dense_defaults[j], |
701 | /// then the Feature context_dense_keys[j] is required. |
702 | /// The input type is inferred from context_dense_defaults[j], even when it's |
703 | /// empty. If context_dense_defaults[j] is not empty, its shape must match |
704 | /// context_dense_shapes[j]. |
705 | /// |
706 | /// Optional attributes (see `Attrs`): |
707 | /// * context_sparse_types: A list of Ncontext_sparse types; the data types of data in |
708 | /// each context Feature given in context_sparse_keys. |
709 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
710 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
711 | /// * context_ragged_value_types: RaggedTensor.value dtypes for the ragged context features. |
712 | /// * context_ragged_split_types: RaggedTensor.row_split dtypes for the ragged context features. |
713 | /// * context_dense_shapes: A list of Ncontext_dense shapes; the shapes of data in |
714 | /// each context Feature given in context_dense_keys. |
715 | /// The number of elements in the Feature corresponding to context_dense_key[j] |
716 | /// must always equal context_dense_shapes[j].NumEntries(). |
717 | /// The shape of context_dense_values[j] will match context_dense_shapes[j]. |
718 | /// * feature_list_sparse_types: A list of Nfeature_list_sparse types; the data types |
719 | /// of data in each FeatureList given in feature_list_sparse_keys. |
720 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
721 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
722 | /// * feature_list_ragged_value_types: RaggedTensor.value dtypes for the ragged FeatureList features. |
723 | /// * feature_list_ragged_split_types: RaggedTensor.row_split dtypes for the ragged FeatureList features. |
724 | /// * feature_list_dense_shapes: A list of Nfeature_list_dense shapes; the shapes of |
725 | /// data in each FeatureList given in feature_list_dense_keys. |
726 | /// The shape of each Feature in the FeatureList corresponding to |
727 | /// feature_list_dense_key[j] must always equal |
728 | /// feature_list_dense_shapes[j].NumEntries(). |
729 | /// |
730 | /// Returns: |
731 | /// * `OutputList` context_sparse_indices |
732 | /// * `OutputList` context_sparse_values |
733 | /// * `OutputList` context_sparse_shapes |
734 | /// * `OutputList` context_dense_values |
735 | /// * `OutputList` context_ragged_values |
736 | /// * `OutputList` context_ragged_row_splits |
737 | /// * `OutputList` feature_list_sparse_indices |
738 | /// * `OutputList` feature_list_sparse_values |
739 | /// * `OutputList` feature_list_sparse_shapes |
740 | /// * `OutputList` feature_list_dense_values |
741 | /// * `OutputList` feature_list_dense_lengths |
742 | /// * `OutputList` feature_list_ragged_values |
743 | /// * `OutputList` feature_list_ragged_outer_splits |
744 | /// * `OutputList` feature_list_ragged_inner_splits |
745 | class ParseSequenceExampleV2 { |
746 | public: |
747 | /// Optional attribute setters for ParseSequenceExampleV2 |
748 | struct Attrs { |
749 | /// Defaults to 0 |
750 | TF_MUST_USE_RESULT Attrs NcontextSparse(int64 x) { |
751 | Attrs ret = *this; |
752 | ret.Ncontext_sparse_ = x; |
753 | return ret; |
754 | } |
755 | |
756 | /// A list of Ncontext_sparse types; the data types of data in |
757 | /// each context Feature given in context_sparse_keys. |
758 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
759 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
760 | /// |
761 | /// Defaults to [] |
762 | TF_MUST_USE_RESULT Attrs ContextSparseTypes(const DataTypeSlice& x) { |
763 | Attrs ret = *this; |
764 | ret.context_sparse_types_ = x; |
765 | return ret; |
766 | } |
767 | |
768 | /// RaggedTensor.value dtypes for the ragged context features. |
769 | /// |
770 | /// Defaults to [] |
771 | TF_MUST_USE_RESULT Attrs (const DataTypeSlice& x) { |
772 | Attrs ret = *this; |
773 | ret.context_ragged_value_types_ = x; |
774 | return ret; |
775 | } |
776 | |
777 | /// RaggedTensor.row_split dtypes for the ragged context features. |
778 | /// |
779 | /// Defaults to [] |
780 | TF_MUST_USE_RESULT Attrs (const DataTypeSlice& x) { |
781 | Attrs ret = *this; |
782 | ret.context_ragged_split_types_ = x; |
783 | return ret; |
784 | } |
785 | |
786 | /// A list of Ncontext_dense shapes; the shapes of data in |
787 | /// each context Feature given in context_dense_keys. |
788 | /// The number of elements in the Feature corresponding to context_dense_key[j] |
789 | /// must always equal context_dense_shapes[j].NumEntries(). |
790 | /// The shape of context_dense_values[j] will match context_dense_shapes[j]. |
791 | /// |
792 | /// Defaults to [] |
793 | TF_MUST_USE_RESULT Attrs ContextDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
794 | Attrs ret = *this; |
795 | ret.context_dense_shapes_ = x; |
796 | return ret; |
797 | } |
798 | |
799 | /// Defaults to 0 |
800 | TF_MUST_USE_RESULT Attrs NfeatureListSparse(int64 x) { |
801 | Attrs ret = *this; |
802 | ret.Nfeature_list_sparse_ = x; |
803 | return ret; |
804 | } |
805 | |
806 | /// Defaults to 0 |
807 | TF_MUST_USE_RESULT Attrs NfeatureListDense(int64 x) { |
808 | Attrs ret = *this; |
809 | ret.Nfeature_list_dense_ = x; |
810 | return ret; |
811 | } |
812 | |
813 | /// Defaults to [] |
814 | TF_MUST_USE_RESULT Attrs FeatureListDenseTypes(const DataTypeSlice& x) { |
815 | Attrs ret = *this; |
816 | ret.feature_list_dense_types_ = x; |
817 | return ret; |
818 | } |
819 | |
820 | /// A list of Nfeature_list_sparse types; the data types |
821 | /// of data in each FeatureList given in feature_list_sparse_keys. |
822 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
823 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
824 | /// |
825 | /// Defaults to [] |
826 | TF_MUST_USE_RESULT Attrs FeatureListSparseTypes(const DataTypeSlice& x) { |
827 | Attrs ret = *this; |
828 | ret.feature_list_sparse_types_ = x; |
829 | return ret; |
830 | } |
831 | |
832 | /// RaggedTensor.value dtypes for the ragged FeatureList features. |
833 | /// |
834 | /// Defaults to [] |
835 | TF_MUST_USE_RESULT Attrs FeatureListRaggedValueTypes(const DataTypeSlice& x) { |
836 | Attrs ret = *this; |
837 | ret.feature_list_ragged_value_types_ = x; |
838 | return ret; |
839 | } |
840 | |
841 | /// RaggedTensor.row_split dtypes for the ragged FeatureList features. |
842 | /// |
843 | /// Defaults to [] |
844 | TF_MUST_USE_RESULT Attrs FeatureListRaggedSplitTypes(const DataTypeSlice& x) { |
845 | Attrs ret = *this; |
846 | ret.feature_list_ragged_split_types_ = x; |
847 | return ret; |
848 | } |
849 | |
850 | /// A list of Nfeature_list_dense shapes; the shapes of |
851 | /// data in each FeatureList given in feature_list_dense_keys. |
852 | /// The shape of each Feature in the FeatureList corresponding to |
853 | /// feature_list_dense_key[j] must always equal |
854 | /// feature_list_dense_shapes[j].NumEntries(). |
855 | /// |
856 | /// Defaults to [] |
857 | TF_MUST_USE_RESULT Attrs FeatureListDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
858 | Attrs ret = *this; |
859 | ret.feature_list_dense_shapes_ = x; |
860 | return ret; |
861 | } |
862 | |
863 | int64 Ncontext_sparse_ = 0; |
864 | DataTypeSlice context_sparse_types_ = {}; |
865 | DataTypeSlice context_ragged_value_types_ = {}; |
866 | DataTypeSlice context_ragged_split_types_ = {}; |
867 | gtl::ArraySlice<PartialTensorShape> context_dense_shapes_ = {}; |
868 | int64 Nfeature_list_sparse_ = 0; |
869 | int64 Nfeature_list_dense_ = 0; |
870 | DataTypeSlice feature_list_dense_types_ = {}; |
871 | DataTypeSlice feature_list_sparse_types_ = {}; |
872 | DataTypeSlice feature_list_ragged_value_types_ = {}; |
873 | DataTypeSlice feature_list_ragged_split_types_ = {}; |
874 | gtl::ArraySlice<PartialTensorShape> feature_list_dense_shapes_ = {}; |
875 | }; |
876 | ParseSequenceExampleV2(const ::tensorflow::Scope& scope, ::tensorflow::Input |
877 | serialized, ::tensorflow::Input debug_name, |
878 | ::tensorflow::Input context_sparse_keys, |
879 | ::tensorflow::Input context_dense_keys, |
880 | ::tensorflow::Input context_ragged_keys, |
881 | ::tensorflow::Input feature_list_sparse_keys, |
882 | ::tensorflow::Input feature_list_dense_keys, |
883 | ::tensorflow::Input feature_list_ragged_keys, |
884 | ::tensorflow::Input |
885 | feature_list_dense_missing_assumed_empty, |
886 | ::tensorflow::InputList context_dense_defaults); |
887 | ParseSequenceExampleV2(const ::tensorflow::Scope& scope, ::tensorflow::Input |
888 | serialized, ::tensorflow::Input debug_name, |
889 | ::tensorflow::Input context_sparse_keys, |
890 | ::tensorflow::Input context_dense_keys, |
891 | ::tensorflow::Input context_ragged_keys, |
892 | ::tensorflow::Input feature_list_sparse_keys, |
893 | ::tensorflow::Input feature_list_dense_keys, |
894 | ::tensorflow::Input feature_list_ragged_keys, |
895 | ::tensorflow::Input |
896 | feature_list_dense_missing_assumed_empty, |
897 | ::tensorflow::InputList context_dense_defaults, const |
898 | ParseSequenceExampleV2::Attrs& attrs); |
899 | |
900 | static Attrs NcontextSparse(int64 x) { |
901 | return Attrs().NcontextSparse(x); |
902 | } |
903 | static Attrs ContextSparseTypes(const DataTypeSlice& x) { |
904 | return Attrs().ContextSparseTypes(x); |
905 | } |
906 | static Attrs (const DataTypeSlice& x) { |
907 | return Attrs().ContextRaggedValueTypes(x); |
908 | } |
909 | static Attrs (const DataTypeSlice& x) { |
910 | return Attrs().ContextRaggedSplitTypes(x); |
911 | } |
912 | static Attrs ContextDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
913 | return Attrs().ContextDenseShapes(x); |
914 | } |
915 | static Attrs NfeatureListSparse(int64 x) { |
916 | return Attrs().NfeatureListSparse(x); |
917 | } |
918 | static Attrs NfeatureListDense(int64 x) { |
919 | return Attrs().NfeatureListDense(x); |
920 | } |
921 | static Attrs FeatureListDenseTypes(const DataTypeSlice& x) { |
922 | return Attrs().FeatureListDenseTypes(x); |
923 | } |
924 | static Attrs FeatureListSparseTypes(const DataTypeSlice& x) { |
925 | return Attrs().FeatureListSparseTypes(x); |
926 | } |
927 | static Attrs FeatureListRaggedValueTypes(const DataTypeSlice& x) { |
928 | return Attrs().FeatureListRaggedValueTypes(x); |
929 | } |
930 | static Attrs FeatureListRaggedSplitTypes(const DataTypeSlice& x) { |
931 | return Attrs().FeatureListRaggedSplitTypes(x); |
932 | } |
933 | static Attrs FeatureListDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
934 | return Attrs().FeatureListDenseShapes(x); |
935 | } |
936 | |
937 | Operation operation; |
938 | ::tensorflow::OutputList context_sparse_indices; |
939 | ::tensorflow::OutputList context_sparse_values; |
940 | ::tensorflow::OutputList context_sparse_shapes; |
941 | ::tensorflow::OutputList context_dense_values; |
942 | ::tensorflow::OutputList context_ragged_values; |
943 | ::tensorflow::OutputList context_ragged_row_splits; |
944 | ::tensorflow::OutputList feature_list_sparse_indices; |
945 | ::tensorflow::OutputList feature_list_sparse_values; |
946 | ::tensorflow::OutputList feature_list_sparse_shapes; |
947 | ::tensorflow::OutputList feature_list_dense_values; |
948 | ::tensorflow::OutputList feature_list_dense_lengths; |
949 | ::tensorflow::OutputList feature_list_ragged_values; |
950 | ::tensorflow::OutputList feature_list_ragged_outer_splits; |
951 | ::tensorflow::OutputList feature_list_ragged_inner_splits; |
952 | }; |
953 | |
954 | /// Transforms a tf.Example proto (as a string) into typed tensors. |
955 | /// |
956 | /// Args: |
957 | /// * scope: A Scope object |
958 | /// * serialized: A vector containing a batch of binary serialized Example protos. |
959 | /// * dense_defaults: A list of Tensors (some may be empty), whose length matches |
960 | /// the length of `dense_keys`. dense_defaults[j] provides default values |
961 | /// when the example's feature_map lacks dense_key[j]. If an empty Tensor is |
962 | /// provided for dense_defaults[j], then the Feature dense_keys[j] is required. |
963 | /// The input type is inferred from dense_defaults[j], even when it's empty. |
964 | /// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, |
965 | /// then the shape of dense_defaults[j] must match that of dense_shapes[j]. |
966 | /// If dense_shapes[j] has an undefined major dimension (variable strides dense |
967 | /// feature), dense_defaults[j] must contain a single element: |
968 | /// the padding element. |
969 | /// * num_sparse: The number of sparse features to be parsed from the example. This |
970 | /// must match the lengths of `sparse_keys` and `sparse_types`. |
971 | /// * sparse_keys: A list of `num_sparse` strings. |
972 | /// The keys expected in the Examples' features associated with sparse values. |
973 | /// * dense_keys: The keys expected in the Examples' features associated with dense |
974 | /// values. |
975 | /// * sparse_types: A list of `num_sparse` types; the data types of data in each |
976 | /// Feature given in sparse_keys. |
977 | /// Currently the ParseSingleExample op supports DT_FLOAT (FloatList), |
978 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
979 | /// * dense_shapes: The shapes of data in each Feature given in dense_keys. |
980 | /// The length of this list must match the length of `dense_keys`. The |
981 | /// number of elements in the Feature corresponding to dense_key[j] must |
982 | /// always equal dense_shapes[j].NumEntries(). If dense_shapes[j] == |
983 | /// (D0, D1, ..., DN) then the shape of output Tensor dense_values[j] |
984 | /// will be (D0, D1, ..., DN): In the case dense_shapes[j] = (-1, D1, |
985 | /// ..., DN), the shape of the output Tensor dense_values[j] will be (M, |
986 | /// D1, .., DN), where M is the number of blocks of elements of length |
987 | /// D1 * .... * DN, in the input. |
988 | /// |
989 | /// Returns: |
990 | /// * `OutputList` sparse_indices |
991 | /// * `OutputList` sparse_values |
992 | /// * `OutputList` sparse_shapes |
993 | /// * `OutputList` dense_values |
994 | class ParseSingleExample { |
995 | public: |
996 | ParseSingleExample(const ::tensorflow::Scope& scope, ::tensorflow::Input |
997 | serialized, ::tensorflow::InputList dense_defaults, int64 |
998 | num_sparse, const gtl::ArraySlice<::tensorflow::tstring>& |
999 | sparse_keys, const gtl::ArraySlice<::tensorflow::tstring>& |
1000 | dense_keys, const DataTypeSlice& sparse_types, const |
1001 | gtl::ArraySlice<PartialTensorShape>& dense_shapes); |
1002 | |
1003 | Operation operation; |
1004 | ::tensorflow::OutputList sparse_indices; |
1005 | ::tensorflow::OutputList sparse_values; |
1006 | ::tensorflow::OutputList sparse_shapes; |
1007 | ::tensorflow::OutputList dense_values; |
1008 | }; |
1009 | |
1010 | /// Transforms a scalar brain.SequenceExample proto (as strings) into typed tensors. |
1011 | /// |
1012 | /// Args: |
1013 | /// * scope: A Scope object |
1014 | /// * serialized: A scalar containing a binary serialized SequenceExample proto. |
1015 | /// * feature_list_dense_missing_assumed_empty: A vector listing the |
1016 | /// FeatureList keys which may be missing from the SequenceExample. If the |
1017 | /// associated FeatureList is missing, it is treated as empty. By default, |
1018 | /// any FeatureList not listed in this vector must exist in the SequenceExample. |
1019 | /// * context_sparse_keys: A list of Ncontext_sparse string Tensors (scalars). |
1020 | /// The keys expected in the Examples' features associated with context_sparse |
1021 | /// values. |
1022 | /// * context_dense_keys: A list of Ncontext_dense string Tensors (scalars). |
1023 | /// The keys expected in the SequenceExamples' context features associated with |
1024 | /// dense values. |
1025 | /// * feature_list_sparse_keys: A list of Nfeature_list_sparse string Tensors |
1026 | /// (scalars). The keys expected in the FeatureLists associated with sparse |
1027 | /// values. |
1028 | /// * feature_list_dense_keys: A list of Nfeature_list_dense string Tensors (scalars). |
1029 | /// The keys expected in the SequenceExamples' feature_lists associated |
1030 | /// with lists of dense values. |
1031 | /// * context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). |
1032 | /// context_dense_defaults[j] provides default values |
1033 | /// when the SequenceExample's context map lacks context_dense_key[j]. |
1034 | /// If an empty Tensor is provided for context_dense_defaults[j], |
1035 | /// then the Feature context_dense_keys[j] is required. |
1036 | /// The input type is inferred from context_dense_defaults[j], even when it's |
1037 | /// empty. If context_dense_defaults[j] is not empty, its shape must match |
1038 | /// context_dense_shapes[j]. |
1039 | /// * debug_name: A scalar containing the name of the serialized proto. |
1040 | /// May contain, for example, table key (descriptive) name for the |
1041 | /// corresponding serialized proto. This is purely useful for debugging |
1042 | /// purposes, and the presence of values here has no effect on the output. |
1043 | /// May also be an empty scalar if no name is available. |
1044 | /// |
1045 | /// Optional attributes (see `Attrs`): |
1046 | /// * context_sparse_types: A list of Ncontext_sparse types; the data types of data in |
1047 | /// each context Feature given in context_sparse_keys. |
1048 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
1049 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
1050 | /// * context_dense_shapes: A list of Ncontext_dense shapes; the shapes of data in |
1051 | /// each context Feature given in context_dense_keys. |
1052 | /// The number of elements in the Feature corresponding to context_dense_key[j] |
1053 | /// must always equal context_dense_shapes[j].NumEntries(). |
1054 | /// The shape of context_dense_values[j] will match context_dense_shapes[j]. |
1055 | /// * feature_list_sparse_types: A list of Nfeature_list_sparse types; the data types |
1056 | /// of data in each FeatureList given in feature_list_sparse_keys. |
1057 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
1058 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
1059 | /// * feature_list_dense_shapes: A list of Nfeature_list_dense shapes; the shapes of |
1060 | /// data in each FeatureList given in feature_list_dense_keys. |
1061 | /// The shape of each Feature in the FeatureList corresponding to |
1062 | /// feature_list_dense_key[j] must always equal |
1063 | /// feature_list_dense_shapes[j].NumEntries(). |
1064 | /// |
1065 | /// Returns: |
1066 | /// * `OutputList` context_sparse_indices |
1067 | /// * `OutputList` context_sparse_values |
1068 | /// * `OutputList` context_sparse_shapes |
1069 | /// * `OutputList` context_dense_values |
1070 | /// * `OutputList` feature_list_sparse_indices |
1071 | /// * `OutputList` feature_list_sparse_values |
1072 | /// * `OutputList` feature_list_sparse_shapes |
1073 | /// * `OutputList` feature_list_dense_values |
1074 | class ParseSingleSequenceExample { |
1075 | public: |
1076 | /// Optional attribute setters for ParseSingleSequenceExample |
1077 | struct Attrs { |
1078 | /// A list of Ncontext_sparse types; the data types of data in |
1079 | /// each context Feature given in context_sparse_keys. |
1080 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
1081 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
1082 | /// |
1083 | /// Defaults to [] |
1084 | TF_MUST_USE_RESULT Attrs ContextSparseTypes(const DataTypeSlice& x) { |
1085 | Attrs ret = *this; |
1086 | ret.context_sparse_types_ = x; |
1087 | return ret; |
1088 | } |
1089 | |
1090 | /// Defaults to [] |
1091 | TF_MUST_USE_RESULT Attrs FeatureListDenseTypes(const DataTypeSlice& x) { |
1092 | Attrs ret = *this; |
1093 | ret.feature_list_dense_types_ = x; |
1094 | return ret; |
1095 | } |
1096 | |
1097 | /// A list of Ncontext_dense shapes; the shapes of data in |
1098 | /// each context Feature given in context_dense_keys. |
1099 | /// The number of elements in the Feature corresponding to context_dense_key[j] |
1100 | /// must always equal context_dense_shapes[j].NumEntries(). |
1101 | /// The shape of context_dense_values[j] will match context_dense_shapes[j]. |
1102 | /// |
1103 | /// Defaults to [] |
1104 | TF_MUST_USE_RESULT Attrs ContextDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
1105 | Attrs ret = *this; |
1106 | ret.context_dense_shapes_ = x; |
1107 | return ret; |
1108 | } |
1109 | |
1110 | /// A list of Nfeature_list_sparse types; the data types |
1111 | /// of data in each FeatureList given in feature_list_sparse_keys. |
1112 | /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), |
1113 | /// DT_INT64 (Int64List), and DT_STRING (BytesList). |
1114 | /// |
1115 | /// Defaults to [] |
1116 | TF_MUST_USE_RESULT Attrs FeatureListSparseTypes(const DataTypeSlice& x) { |
1117 | Attrs ret = *this; |
1118 | ret.feature_list_sparse_types_ = x; |
1119 | return ret; |
1120 | } |
1121 | |
1122 | /// A list of Nfeature_list_dense shapes; the shapes of |
1123 | /// data in each FeatureList given in feature_list_dense_keys. |
1124 | /// The shape of each Feature in the FeatureList corresponding to |
1125 | /// feature_list_dense_key[j] must always equal |
1126 | /// feature_list_dense_shapes[j].NumEntries(). |
1127 | /// |
1128 | /// Defaults to [] |
1129 | TF_MUST_USE_RESULT Attrs FeatureListDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
1130 | Attrs ret = *this; |
1131 | ret.feature_list_dense_shapes_ = x; |
1132 | return ret; |
1133 | } |
1134 | |
1135 | DataTypeSlice context_sparse_types_ = {}; |
1136 | DataTypeSlice feature_list_dense_types_ = {}; |
1137 | gtl::ArraySlice<PartialTensorShape> context_dense_shapes_ = {}; |
1138 | DataTypeSlice feature_list_sparse_types_ = {}; |
1139 | gtl::ArraySlice<PartialTensorShape> feature_list_dense_shapes_ = {}; |
1140 | }; |
1141 | ParseSingleSequenceExample(const ::tensorflow::Scope& scope, |
1142 | ::tensorflow::Input serialized, ::tensorflow::Input |
1143 | feature_list_dense_missing_assumed_empty, |
1144 | ::tensorflow::InputList context_sparse_keys, |
1145 | ::tensorflow::InputList context_dense_keys, |
1146 | ::tensorflow::InputList feature_list_sparse_keys, |
1147 | ::tensorflow::InputList feature_list_dense_keys, |
1148 | ::tensorflow::InputList context_dense_defaults, |
1149 | ::tensorflow::Input debug_name); |
1150 | ParseSingleSequenceExample(const ::tensorflow::Scope& scope, |
1151 | ::tensorflow::Input serialized, ::tensorflow::Input |
1152 | feature_list_dense_missing_assumed_empty, |
1153 | ::tensorflow::InputList context_sparse_keys, |
1154 | ::tensorflow::InputList context_dense_keys, |
1155 | ::tensorflow::InputList feature_list_sparse_keys, |
1156 | ::tensorflow::InputList feature_list_dense_keys, |
1157 | ::tensorflow::InputList context_dense_defaults, |
1158 | ::tensorflow::Input debug_name, const |
1159 | ParseSingleSequenceExample::Attrs& attrs); |
1160 | |
1161 | static Attrs ContextSparseTypes(const DataTypeSlice& x) { |
1162 | return Attrs().ContextSparseTypes(x); |
1163 | } |
1164 | static Attrs FeatureListDenseTypes(const DataTypeSlice& x) { |
1165 | return Attrs().FeatureListDenseTypes(x); |
1166 | } |
1167 | static Attrs ContextDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
1168 | return Attrs().ContextDenseShapes(x); |
1169 | } |
1170 | static Attrs FeatureListSparseTypes(const DataTypeSlice& x) { |
1171 | return Attrs().FeatureListSparseTypes(x); |
1172 | } |
1173 | static Attrs FeatureListDenseShapes(const gtl::ArraySlice<PartialTensorShape>& x) { |
1174 | return Attrs().FeatureListDenseShapes(x); |
1175 | } |
1176 | |
1177 | Operation operation; |
1178 | ::tensorflow::OutputList context_sparse_indices; |
1179 | ::tensorflow::OutputList context_sparse_values; |
1180 | ::tensorflow::OutputList context_sparse_shapes; |
1181 | ::tensorflow::OutputList context_dense_values; |
1182 | ::tensorflow::OutputList feature_list_sparse_indices; |
1183 | ::tensorflow::OutputList feature_list_sparse_values; |
1184 | ::tensorflow::OutputList feature_list_sparse_shapes; |
1185 | ::tensorflow::OutputList feature_list_dense_values; |
1186 | }; |
1187 | |
1188 | /// Transforms a serialized tensorflow.TensorProto proto into a Tensor. |
1189 | /// |
1190 | /// Args: |
1191 | /// * scope: A Scope object |
1192 | /// * serialized: A scalar string containing a serialized TensorProto proto. |
1193 | /// * out_type: The type of the serialized tensor. The provided type must match the |
1194 | /// type of the serialized tensor and no implicit conversion will take place. |
1195 | /// |
1196 | /// Returns: |
1197 | /// * `Output`: A Tensor of type `out_type`. |
1198 | class ParseTensor { |
1199 | public: |
1200 | ParseTensor(const ::tensorflow::Scope& scope, ::tensorflow::Input serialized, |
1201 | DataType out_type); |
1202 | operator ::tensorflow::Output() const { return output; } |
1203 | operator ::tensorflow::Input() const { return output; } |
1204 | ::tensorflow::Node* node() const { return output.node(); } |
1205 | |
1206 | Operation operation; |
1207 | ::tensorflow::Output output; |
1208 | }; |
1209 | |
1210 | /// Transforms a Tensor into a serialized TensorProto proto. |
1211 | /// |
1212 | /// Args: |
1213 | /// * scope: A Scope object |
1214 | /// * tensor: A Tensor of type `T`. |
1215 | /// |
1216 | /// Returns: |
1217 | /// * `Output`: A serialized TensorProto proto of the input tensor. |
1218 | class SerializeTensor { |
1219 | public: |
1220 | SerializeTensor(const ::tensorflow::Scope& scope, ::tensorflow::Input tensor); |
1221 | operator ::tensorflow::Output() const { return serialized; } |
1222 | operator ::tensorflow::Input() const { return serialized; } |
1223 | ::tensorflow::Node* node() const { return serialized.node(); } |
1224 | |
1225 | Operation operation; |
1226 | ::tensorflow::Output serialized; |
1227 | }; |
1228 | |
1229 | /// Converts each string in the input Tensor to the specified numeric type. |
1230 | /// |
1231 | /// (Note that int32 overflow results in an error while float overflow |
1232 | /// results in a rounded value.) |
1233 | /// |
1234 | /// Example: |
1235 | /// |
1236 | /// >>> strings = ["5.0", "3.0", "7.0"] |
1237 | /// >>> tf.strings.to_number(strings) |
1238 | /// <tf.Tensor: shape=(3,), dtype=float32, numpy=array([5., 3., 7.], dtype=float32)> |
1239 | /// |
1240 | /// |
1241 | /// Args: |
1242 | /// * scope: A Scope object |
1243 | /// |
1244 | /// Optional attributes (see `Attrs`): |
1245 | /// * out_type: The numeric type to interpret each string in `string_tensor` as. |
1246 | /// |
1247 | /// Returns: |
1248 | /// * `Output`: A Tensor of the same shape as the input `string_tensor`. |
1249 | class StringToNumber { |
1250 | public: |
1251 | /// Optional attribute setters for StringToNumber |
1252 | struct Attrs { |
1253 | /// The numeric type to interpret each string in `string_tensor` as. |
1254 | /// |
1255 | /// Defaults to DT_FLOAT |
1256 | TF_MUST_USE_RESULT Attrs OutType(DataType x) { |
1257 | Attrs ret = *this; |
1258 | ret.out_type_ = x; |
1259 | return ret; |
1260 | } |
1261 | |
1262 | DataType out_type_ = DT_FLOAT; |
1263 | }; |
1264 | StringToNumber(const ::tensorflow::Scope& scope, ::tensorflow::Input |
1265 | string_tensor); |
1266 | StringToNumber(const ::tensorflow::Scope& scope, ::tensorflow::Input |
1267 | string_tensor, const StringToNumber::Attrs& attrs); |
1268 | operator ::tensorflow::Output() const { return output; } |
1269 | operator ::tensorflow::Input() const { return output; } |
1270 | ::tensorflow::Node* node() const { return output.node(); } |
1271 | |
1272 | static Attrs OutType(DataType x) { |
1273 | return Attrs().OutType(x); |
1274 | } |
1275 | |
1276 | Operation operation; |
1277 | ::tensorflow::Output output; |
1278 | }; |
1279 | |
1280 | /// @} |
1281 | |
1282 | } // namespace ops |
1283 | } // namespace tensorflow |
1284 | |
1285 | #endif // TENSORFLOW_CC_OPS_PARSING_OPS_H_ |
1286 | |