1// This file is MACHINE GENERATED! Do not edit.
2
3#ifndef TENSORFLOW_CC_OPS_LOGGING_OPS_H_
4#define TENSORFLOW_CC_OPS_LOGGING_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 logging_ops Logging Ops
19/// @{
20
21/// Asserts that the given condition is true.
22///
23/// If `condition` evaluates to false, print the list of tensors in `data`.
24/// `summarize` determines how many entries of the tensors to print.
25///
26/// Args:
27/// * scope: A Scope object
28/// * condition: The condition to evaluate.
29/// * data: The tensors to print out when condition is false.
30///
31/// Optional attributes (see `Attrs`):
32/// * summarize: Print this many entries of each tensor.
33///
34/// Returns:
35/// * the created `Operation`
36class Assert {
37 public:
38 /// Optional attribute setters for Assert
39 struct Attrs {
40 /// Print this many entries of each tensor.
41 ///
42 /// Defaults to 3
43 TF_MUST_USE_RESULT Attrs Summarize(int64 x) {
44 Attrs ret = *this;
45 ret.summarize_ = x;
46 return ret;
47 }
48
49 int64 summarize_ = 3;
50 };
51 Assert(const ::tensorflow::Scope& scope, ::tensorflow::Input condition,
52 ::tensorflow::InputList data);
53 Assert(const ::tensorflow::Scope& scope, ::tensorflow::Input condition,
54 ::tensorflow::InputList data, const Assert::Attrs& attrs);
55 operator ::tensorflow::Operation() const { return operation; }
56
57 static Attrs Summarize(int64 x) {
58 return Attrs().Summarize(x);
59 }
60
61 Operation operation;
62};
63
64/// Outputs a `Summary` protocol buffer with audio.
65///
66/// The summary has up to `max_outputs` summary values containing audio. The
67/// audio is built from `tensor` which must be 3-D with shape `[batch_size,
68/// frames, channels]` or 2-D with shape `[batch_size, frames]`. The values are
69/// assumed to be in the range of `[-1.0, 1.0]` with a sample rate of `sample_rate`.
70///
71/// The `tag` argument is a scalar `Tensor` of type `string`. It is used to
72/// build the `tag` of the summary values:
73///
74/// * If `max_outputs` is 1, the summary value tag is '*tag*/audio'.
75/// * If `max_outputs` is greater than 1, the summary value tags are
76/// generated sequentially as '*tag*/audio/0', '*tag*/audio/1', etc.
77///
78/// Args:
79/// * scope: A Scope object
80/// * tag: Scalar. Used to build the `tag` attribute of the summary values.
81/// * tensor: 2-D of shape `[batch_size, frames]`.
82/// * sample_rate: The sample rate of the signal in hertz.
83///
84/// Optional attributes (see `Attrs`):
85/// * max_outputs: Max number of batch elements to generate audio for.
86///
87/// Returns:
88/// * `Output`: Scalar. Serialized `Summary` protocol buffer.
89class AudioSummary {
90 public:
91 /// Optional attribute setters for AudioSummary
92 struct Attrs {
93 /// Max number of batch elements to generate audio for.
94 ///
95 /// Defaults to 3
96 TF_MUST_USE_RESULT Attrs MaxOutputs(int64 x) {
97 Attrs ret = *this;
98 ret.max_outputs_ = x;
99 return ret;
100 }
101
102 int64 max_outputs_ = 3;
103 };
104 AudioSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tag,
105 ::tensorflow::Input tensor, ::tensorflow::Input sample_rate);
106 AudioSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tag,
107 ::tensorflow::Input tensor, ::tensorflow::Input sample_rate, const
108 AudioSummary::Attrs& attrs);
109 operator ::tensorflow::Output() const { return summary; }
110 operator ::tensorflow::Input() const { return summary; }
111 ::tensorflow::Node* node() const { return summary.node(); }
112
113 static Attrs MaxOutputs(int64 x) {
114 return Attrs().MaxOutputs(x);
115 }
116
117 Operation operation;
118 ::tensorflow::Output summary;
119};
120
121/// Outputs a `Summary` protocol buffer with a histogram.
122///
123/// The generated
124/// [`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto)
125/// has one summary value containing a histogram for `values`.
126///
127/// This op reports an `InvalidArgument` error if any value is not finite.
128///
129/// Args:
130/// * scope: A Scope object
131/// * tag: Scalar. Tag to use for the `Summary.Value`.
132/// * values: Any shape. Values to use to build the histogram.
133///
134/// Returns:
135/// * `Output`: Scalar. Serialized `Summary` protocol buffer.
136class HistogramSummary {
137 public:
138 HistogramSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tag,
139 ::tensorflow::Input values);
140 operator ::tensorflow::Output() const { return summary; }
141 operator ::tensorflow::Input() const { return summary; }
142 ::tensorflow::Node* node() const { return summary.node(); }
143
144 Operation operation;
145 ::tensorflow::Output summary;
146};
147
148/// Outputs a `Summary` protocol buffer with images.
149///
150/// The summary has up to `max_images` summary values containing images. The
151/// images are built from `tensor` which must be 4-D with shape `[batch_size,
152/// height, width, channels]` and where `channels` can be:
153///
154/// * 1: `tensor` is interpreted as Grayscale.
155/// * 3: `tensor` is interpreted as RGB.
156/// * 4: `tensor` is interpreted as RGBA.
157///
158/// The images have the same number of channels as the input tensor. For float
159/// input, the values are normalized one image at a time to fit in the range
160/// `[0, 255]`. `uint8` values are unchanged. The op uses two different
161/// normalization algorithms:
162///
163/// * If the input values are all positive, they are rescaled so the largest one
164/// is 255.
165///
166/// * If any input value is negative, the values are shifted so input value 0.0
167/// is at 127. They are then rescaled so that either the smallest value is 0,
168/// or the largest one is 255.
169///
170/// The `tag` argument is a scalar `Tensor` of type `string`. It is used to
171/// build the `tag` of the summary values:
172///
173/// * If `max_images` is 1, the summary value tag is '*tag*/image'.
174/// * If `max_images` is greater than 1, the summary value tags are
175/// generated sequentially as '*tag*/image/0', '*tag*/image/1', etc.
176///
177/// The `bad_color` argument is the color to use in the generated images for
178/// non-finite input values. It is a `uint8` 1-D tensor of length `channels`.
179/// Each element must be in the range `[0, 255]` (It represents the value of a
180/// pixel in the output image). Non-finite values in the input tensor are
181/// replaced by this tensor in the output image. The default value is the color
182/// red.
183///
184/// Args:
185/// * scope: A Scope object
186/// * tag: Scalar. Used to build the `tag` attribute of the summary values.
187/// * tensor: 4-D of shape `[batch_size, height, width, channels]` where
188/// `channels` is 1, 3, or 4.
189///
190/// Optional attributes (see `Attrs`):
191/// * max_images: Max number of batch elements to generate images for.
192/// * bad_color: Color to use for pixels with non-finite values.
193///
194/// Returns:
195/// * `Output`: Scalar. Serialized `Summary` protocol buffer.
196class ImageSummary {
197 public:
198 /// Optional attribute setters for ImageSummary
199 struct Attrs {
200 /// Max number of batch elements to generate images for.
201 ///
202 /// Defaults to 3
203 TF_MUST_USE_RESULT Attrs MaxImages(int64 x) {
204 Attrs ret = *this;
205 ret.max_images_ = x;
206 return ret;
207 }
208
209 /// Color to use for pixels with non-finite values.
210 ///
211 /// Defaults to Tensor<type: uint8 shape: [4] values: 255 0 0...>
212 TF_MUST_USE_RESULT Attrs BadColor(const TensorProto& x) {
213 Attrs ret = *this;
214 ret.bad_color_ = x;
215 return ret;
216 }
217
218 int64 max_images_ = 3;
219 TensorProto bad_color_ = Input::Initializer({255, 0, 0, 255}, {4}).AsTensorProto();
220 };
221 ImageSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tag,
222 ::tensorflow::Input tensor);
223 ImageSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tag,
224 ::tensorflow::Input tensor, const ImageSummary::Attrs& attrs);
225 operator ::tensorflow::Output() const { return summary; }
226 operator ::tensorflow::Input() const { return summary; }
227 ::tensorflow::Node* node() const { return summary.node(); }
228
229 static Attrs MaxImages(int64 x) {
230 return Attrs().MaxImages(x);
231 }
232 static Attrs BadColor(const TensorProto& x) {
233 return Attrs().BadColor(x);
234 }
235
236 Operation operation;
237 ::tensorflow::Output summary;
238};
239
240/// Merges summaries.
241///
242/// This op creates a
243/// [`Summary`](https://www.tensorflow.org/code/tensorflow/core/framework/summary.proto)
244/// protocol buffer that contains the union of all the values in the input
245/// summaries.
246///
247/// When the Op is run, it reports an `InvalidArgument` error if multiple values
248/// in the summaries to merge use the same tag.
249///
250/// Args:
251/// * scope: A Scope object
252/// * inputs: Can be of any shape. Each must contain serialized `Summary` protocol
253/// buffers.
254///
255/// Returns:
256/// * `Output`: Scalar. Serialized `Summary` protocol buffer.
257class MergeSummary {
258 public:
259 MergeSummary(const ::tensorflow::Scope& scope, ::tensorflow::InputList inputs);
260 operator ::tensorflow::Output() const { return summary; }
261 operator ::tensorflow::Input() const { return summary; }
262 ::tensorflow::Node* node() const { return summary.node(); }
263
264 Operation operation;
265 ::tensorflow::Output summary;
266};
267
268/// Prints a list of tensors.
269///
270/// Passes `input` through to `output` and prints `data` when evaluating.
271///
272/// Args:
273/// * scope: A Scope object
274/// * input: The tensor passed to `output`
275/// * data: A list of tensors to print out when op is evaluated.
276///
277/// Optional attributes (see `Attrs`):
278/// * message: A string, prefix of the error message.
279/// * first_n: Only log `first_n` number of times. -1 disables logging.
280/// * summarize: Only print this many entries of each tensor.
281///
282/// Returns:
283/// * `Output`: The unmodified `input` tensor
284class Print {
285 public:
286 /// Optional attribute setters for Print
287 struct Attrs {
288 /// A string, prefix of the error message.
289 ///
290 /// Defaults to ""
291 TF_MUST_USE_RESULT Attrs Message(StringPiece x) {
292 Attrs ret = *this;
293 ret.message_ = x;
294 return ret;
295 }
296
297 /// Only log `first_n` number of times. -1 disables logging.
298 ///
299 /// Defaults to -1
300 TF_MUST_USE_RESULT Attrs FirstN(int64 x) {
301 Attrs ret = *this;
302 ret.first_n_ = x;
303 return ret;
304 }
305
306 /// Only print this many entries of each tensor.
307 ///
308 /// Defaults to 3
309 TF_MUST_USE_RESULT Attrs Summarize(int64 x) {
310 Attrs ret = *this;
311 ret.summarize_ = x;
312 return ret;
313 }
314
315 StringPiece message_ = "";
316 int64 first_n_ = -1;
317 int64 summarize_ = 3;
318 };
319 Print(const ::tensorflow::Scope& scope, ::tensorflow::Input input,
320 ::tensorflow::InputList data);
321 Print(const ::tensorflow::Scope& scope, ::tensorflow::Input input,
322 ::tensorflow::InputList data, const Print::Attrs& attrs);
323 operator ::tensorflow::Output() const { return output; }
324 operator ::tensorflow::Input() const { return output; }
325 ::tensorflow::Node* node() const { return output.node(); }
326
327 static Attrs Message(StringPiece x) {
328 return Attrs().Message(x);
329 }
330 static Attrs FirstN(int64 x) {
331 return Attrs().FirstN(x);
332 }
333 static Attrs Summarize(int64 x) {
334 return Attrs().Summarize(x);
335 }
336
337 Operation operation;
338 ::tensorflow::Output output;
339};
340
341/// Prints a string scalar.
342///
343/// Prints a string scalar to the desired output_stream.
344///
345/// Args:
346/// * scope: A Scope object
347/// * input: The string scalar to print.
348///
349/// Optional attributes (see `Attrs`):
350/// * output_stream: A string specifying the output stream or logging level to print to.
351///
352/// Returns:
353/// * the created `Operation`
354class PrintV2 {
355 public:
356 /// Optional attribute setters for PrintV2
357 struct Attrs {
358 /// A string specifying the output stream or logging level to print to.
359 ///
360 /// Defaults to "stderr"
361 TF_MUST_USE_RESULT Attrs OutputStream(StringPiece x) {
362 Attrs ret = *this;
363 ret.output_stream_ = x;
364 return ret;
365 }
366
367 /// Defaults to "\n"
368 TF_MUST_USE_RESULT Attrs End(StringPiece x) {
369 Attrs ret = *this;
370 ret.end_ = x;
371 return ret;
372 }
373
374 StringPiece output_stream_ = "stderr";
375 StringPiece end_ = "\n";
376 };
377 PrintV2(const ::tensorflow::Scope& scope, ::tensorflow::Input input);
378 PrintV2(const ::tensorflow::Scope& scope, ::tensorflow::Input input, const
379 PrintV2::Attrs& attrs);
380 operator ::tensorflow::Operation() const { return operation; }
381
382 static Attrs OutputStream(StringPiece x) {
383 return Attrs().OutputStream(x);
384 }
385 static Attrs End(StringPiece x) {
386 return Attrs().End(x);
387 }
388
389 Operation operation;
390};
391
392/// Outputs a `Summary` protocol buffer with scalar values.
393///
394/// The input `tags` and `values` must have the same shape. The generated summary
395/// has a summary value for each tag-value pair in `tags` and `values`.
396///
397/// Args:
398/// * scope: A Scope object
399/// * tags: Tags for the summary.
400/// * values: Same shape as `tags. Values for the summary.
401///
402/// Returns:
403/// * `Output`: Scalar. Serialized `Summary` protocol buffer.
404class ScalarSummary {
405 public:
406 ScalarSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tags,
407 ::tensorflow::Input values);
408 operator ::tensorflow::Output() const { return summary; }
409 operator ::tensorflow::Input() const { return summary; }
410 ::tensorflow::Node* node() const { return summary.node(); }
411
412 Operation operation;
413 ::tensorflow::Output summary;
414};
415
416/// Outputs a `Summary` protocol buffer with a tensor.
417///
418/// This op is being phased out in favor of TensorSummaryV2, which lets callers pass
419/// a tag as well as a serialized SummaryMetadata proto string that contains
420/// plugin-specific data. We will keep this op to maintain backwards compatibility.
421///
422/// Args:
423/// * scope: A Scope object
424/// * tensor: A tensor to serialize.
425///
426/// Optional attributes (see `Attrs`):
427/// * description: A json-encoded SummaryDescription proto.
428/// * labels: An unused list of strings.
429/// * display_name: An unused string.
430///
431/// Returns:
432/// * `Output`: The summary tensor.
433class TensorSummary {
434 public:
435 /// Optional attribute setters for TensorSummary
436 struct Attrs {
437 /// A json-encoded SummaryDescription proto.
438 ///
439 /// Defaults to ""
440 TF_MUST_USE_RESULT Attrs Description(StringPiece x) {
441 Attrs ret = *this;
442 ret.description_ = x;
443 return ret;
444 }
445
446 /// An unused list of strings.
447 ///
448 /// Defaults to []
449 TF_MUST_USE_RESULT Attrs Labels(const gtl::ArraySlice<::tensorflow::tstring>& x) {
450 Attrs ret = *this;
451 ret.labels_ = x;
452 return ret;
453 }
454
455 /// An unused string.
456 ///
457 /// Defaults to ""
458 TF_MUST_USE_RESULT Attrs DisplayName(StringPiece x) {
459 Attrs ret = *this;
460 ret.display_name_ = x;
461 return ret;
462 }
463
464 StringPiece description_ = "";
465 gtl::ArraySlice<::tensorflow::tstring> labels_ = {};
466 StringPiece display_name_ = "";
467 };
468 TensorSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tensor);
469 TensorSummary(const ::tensorflow::Scope& scope, ::tensorflow::Input tensor,
470 const TensorSummary::Attrs& attrs);
471 operator ::tensorflow::Output() const { return summary; }
472 operator ::tensorflow::Input() const { return summary; }
473 ::tensorflow::Node* node() const { return summary.node(); }
474
475 static Attrs Description(StringPiece x) {
476 return Attrs().Description(x);
477 }
478 static Attrs Labels(const gtl::ArraySlice<::tensorflow::tstring>& x) {
479 return Attrs().Labels(x);
480 }
481 static Attrs DisplayName(StringPiece x) {
482 return Attrs().DisplayName(x);
483 }
484
485 Operation operation;
486 ::tensorflow::Output summary;
487};
488
489/// Outputs a `Summary` protocol buffer with a tensor and per-plugin data.
490///
491/// Args:
492/// * scope: A Scope object
493/// * tag: A string attached to this summary. Used for organization in TensorBoard.
494/// * tensor: A tensor to serialize.
495/// * serialized_summary_metadata: A serialized SummaryMetadata proto. Contains plugin
496/// data.
497///
498/// Returns:
499/// * `Output`: The summary tensor.
500class TensorSummaryV2 {
501 public:
502 TensorSummaryV2(const ::tensorflow::Scope& scope, ::tensorflow::Input tag,
503 ::tensorflow::Input tensor, ::tensorflow::Input
504 serialized_summary_metadata);
505 operator ::tensorflow::Output() const { return summary; }
506 operator ::tensorflow::Input() const { return summary; }
507 ::tensorflow::Node* node() const { return summary.node(); }
508
509 Operation operation;
510 ::tensorflow::Output summary;
511};
512
513/// Provides the time since epoch in seconds.
514///
515/// Returns the timestamp as a `float64` for seconds since the Unix epoch.
516///
517/// Note: the timestamp is computed when the op is executed, not when it is added
518/// to the graph.
519///
520/// Args:
521/// * scope: A Scope object
522///
523/// Returns:
524/// * `Output`: The ts tensor.
525class Timestamp {
526 public:
527 Timestamp(const ::tensorflow::Scope& scope);
528 operator ::tensorflow::Output() const { return ts; }
529 operator ::tensorflow::Input() const { return ts; }
530 ::tensorflow::Node* node() const { return ts.node(); }
531
532 Operation operation;
533 ::tensorflow::Output ts;
534};
535
536/// @}
537
538} // namespace ops
539} // namespace tensorflow
540
541#endif // TENSORFLOW_CC_OPS_LOGGING_OPS_H_
542