Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/python/ops/gen_summary_ops.py: 13%
401 statements
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
1"""Python wrappers around TensorFlow ops.
3This file is MACHINE GENERATED! Do not edit.
4"""
6import collections
8from tensorflow.python import pywrap_tfe as pywrap_tfe
9from tensorflow.python.eager import context as _context
10from tensorflow.python.eager import core as _core
11from tensorflow.python.eager import execute as _execute
12from tensorflow.python.framework import dtypes as _dtypes
13from tensorflow.security.fuzzing.py import annotation_types as _atypes
15from tensorflow.python.framework import op_def_registry as _op_def_registry
16from tensorflow.python.framework import ops as _ops
17from tensorflow.python.framework import op_def_library as _op_def_library
18from tensorflow.python.util.deprecation import deprecated_endpoints
19from tensorflow.python.util import dispatch as _dispatch
20from tensorflow.python.util.tf_export import tf_export
22from typing import TypeVar
24def close_summary_writer(writer, name=None):
25 r"""TODO: add doc.
27 Args:
28 writer: A `Tensor` of type `resource`.
29 name: A name for the operation (optional).
31 Returns:
32 The created Operation.
33 """
34 _ctx = _context._context or _context.context()
35 tld = _ctx._thread_local_data
36 if tld.is_eager:
37 try:
38 _result = pywrap_tfe.TFE_Py_FastPathExecute(
39 _ctx, "CloseSummaryWriter", name, writer)
40 return _result
41 except _core._NotOkStatusException as e:
42 _ops.raise_from_not_ok_status(e, name)
43 except _core._FallbackException:
44 pass
45 try:
46 return close_summary_writer_eager_fallback(
47 writer, name=name, ctx=_ctx)
48 except _core._SymbolicException:
49 pass # Add nodes to the TensorFlow graph.
50 # Add nodes to the TensorFlow graph.
51 _, _, _op, _outputs = _op_def_library._apply_op_helper(
52 "CloseSummaryWriter", writer=writer, name=name)
53 return _op
54CloseSummaryWriter = tf_export("raw_ops.CloseSummaryWriter")(_ops.to_raw_op(close_summary_writer))
57def close_summary_writer_eager_fallback(writer, name, ctx):
58 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
59 _inputs_flat = [writer]
60 _attrs = None
61 _result = _execute.execute(b"CloseSummaryWriter", 0, inputs=_inputs_flat,
62 attrs=_attrs, ctx=ctx, name=name)
63 _result = None
64 return _result
67def create_summary_db_writer(writer, db_uri, experiment_name, run_name, user_name, name=None):
68 r"""TODO: add doc.
70 Args:
71 writer: A `Tensor` of type `resource`.
72 db_uri: A `Tensor` of type `string`.
73 experiment_name: A `Tensor` of type `string`.
74 run_name: A `Tensor` of type `string`.
75 user_name: A `Tensor` of type `string`.
76 name: A name for the operation (optional).
78 Returns:
79 The created Operation.
80 """
81 _ctx = _context._context or _context.context()
82 tld = _ctx._thread_local_data
83 if tld.is_eager:
84 try:
85 _result = pywrap_tfe.TFE_Py_FastPathExecute(
86 _ctx, "CreateSummaryDbWriter", name, writer, db_uri, experiment_name,
87 run_name, user_name)
88 return _result
89 except _core._NotOkStatusException as e:
90 _ops.raise_from_not_ok_status(e, name)
91 except _core._FallbackException:
92 pass
93 try:
94 return create_summary_db_writer_eager_fallback(
95 writer, db_uri, experiment_name, run_name, user_name, name=name,
96 ctx=_ctx)
97 except _core._SymbolicException:
98 pass # Add nodes to the TensorFlow graph.
99 # Add nodes to the TensorFlow graph.
100 _, _, _op, _outputs = _op_def_library._apply_op_helper(
101 "CreateSummaryDbWriter", writer=writer, db_uri=db_uri,
102 experiment_name=experiment_name,
103 run_name=run_name, user_name=user_name,
104 name=name)
105 return _op
106CreateSummaryDbWriter = tf_export("raw_ops.CreateSummaryDbWriter")(_ops.to_raw_op(create_summary_db_writer))
109def create_summary_db_writer_eager_fallback(writer, db_uri, experiment_name, run_name, user_name, name, ctx):
110 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
111 db_uri = _ops.convert_to_tensor(db_uri, _dtypes.string)
112 experiment_name = _ops.convert_to_tensor(experiment_name, _dtypes.string)
113 run_name = _ops.convert_to_tensor(run_name, _dtypes.string)
114 user_name = _ops.convert_to_tensor(user_name, _dtypes.string)
115 _inputs_flat = [writer, db_uri, experiment_name, run_name, user_name]
116 _attrs = None
117 _result = _execute.execute(b"CreateSummaryDbWriter", 0, inputs=_inputs_flat,
118 attrs=_attrs, ctx=ctx, name=name)
119 _result = None
120 return _result
123def create_summary_file_writer(writer, logdir, max_queue, flush_millis, filename_suffix, name=None):
124 r"""TODO: add doc.
126 Args:
127 writer: A `Tensor` of type `resource`.
128 logdir: A `Tensor` of type `string`.
129 max_queue: A `Tensor` of type `int32`.
130 flush_millis: A `Tensor` of type `int32`.
131 filename_suffix: A `Tensor` of type `string`.
132 name: A name for the operation (optional).
134 Returns:
135 The created Operation.
136 """
137 _ctx = _context._context or _context.context()
138 tld = _ctx._thread_local_data
139 if tld.is_eager:
140 try:
141 _result = pywrap_tfe.TFE_Py_FastPathExecute(
142 _ctx, "CreateSummaryFileWriter", name, writer, logdir, max_queue,
143 flush_millis, filename_suffix)
144 return _result
145 except _core._NotOkStatusException as e:
146 _ops.raise_from_not_ok_status(e, name)
147 except _core._FallbackException:
148 pass
149 try:
150 return create_summary_file_writer_eager_fallback(
151 writer, logdir, max_queue, flush_millis, filename_suffix, name=name,
152 ctx=_ctx)
153 except _core._SymbolicException:
154 pass # Add nodes to the TensorFlow graph.
155 # Add nodes to the TensorFlow graph.
156 _, _, _op, _outputs = _op_def_library._apply_op_helper(
157 "CreateSummaryFileWriter", writer=writer, logdir=logdir,
158 max_queue=max_queue,
159 flush_millis=flush_millis,
160 filename_suffix=filename_suffix, name=name)
161 return _op
162CreateSummaryFileWriter = tf_export("raw_ops.CreateSummaryFileWriter")(_ops.to_raw_op(create_summary_file_writer))
165def create_summary_file_writer_eager_fallback(writer, logdir, max_queue, flush_millis, filename_suffix, name, ctx):
166 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
167 logdir = _ops.convert_to_tensor(logdir, _dtypes.string)
168 max_queue = _ops.convert_to_tensor(max_queue, _dtypes.int32)
169 flush_millis = _ops.convert_to_tensor(flush_millis, _dtypes.int32)
170 filename_suffix = _ops.convert_to_tensor(filename_suffix, _dtypes.string)
171 _inputs_flat = [writer, logdir, max_queue, flush_millis, filename_suffix]
172 _attrs = None
173 _result = _execute.execute(b"CreateSummaryFileWriter", 0,
174 inputs=_inputs_flat, attrs=_attrs, ctx=ctx,
175 name=name)
176 _result = None
177 return _result
180def flush_summary_writer(writer, name=None):
181 r"""TODO: add doc.
183 Args:
184 writer: A `Tensor` of type `resource`.
185 name: A name for the operation (optional).
187 Returns:
188 The created Operation.
189 """
190 _ctx = _context._context or _context.context()
191 tld = _ctx._thread_local_data
192 if tld.is_eager:
193 try:
194 _result = pywrap_tfe.TFE_Py_FastPathExecute(
195 _ctx, "FlushSummaryWriter", name, writer)
196 return _result
197 except _core._NotOkStatusException as e:
198 _ops.raise_from_not_ok_status(e, name)
199 except _core._FallbackException:
200 pass
201 try:
202 return flush_summary_writer_eager_fallback(
203 writer, name=name, ctx=_ctx)
204 except _core._SymbolicException:
205 pass # Add nodes to the TensorFlow graph.
206 # Add nodes to the TensorFlow graph.
207 _, _, _op, _outputs = _op_def_library._apply_op_helper(
208 "FlushSummaryWriter", writer=writer, name=name)
209 return _op
210FlushSummaryWriter = tf_export("raw_ops.FlushSummaryWriter")(_ops.to_raw_op(flush_summary_writer))
213def flush_summary_writer_eager_fallback(writer, name, ctx):
214 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
215 _inputs_flat = [writer]
216 _attrs = None
217 _result = _execute.execute(b"FlushSummaryWriter", 0, inputs=_inputs_flat,
218 attrs=_attrs, ctx=ctx, name=name)
219 _result = None
220 return _result
223def import_event(writer, event, name=None):
224 r"""TODO: add doc.
226 Args:
227 writer: A `Tensor` of type `resource`.
228 event: A `Tensor` of type `string`.
229 name: A name for the operation (optional).
231 Returns:
232 The created Operation.
233 """
234 _ctx = _context._context or _context.context()
235 tld = _ctx._thread_local_data
236 if tld.is_eager:
237 try:
238 _result = pywrap_tfe.TFE_Py_FastPathExecute(
239 _ctx, "ImportEvent", name, writer, event)
240 return _result
241 except _core._NotOkStatusException as e:
242 _ops.raise_from_not_ok_status(e, name)
243 except _core._FallbackException:
244 pass
245 try:
246 return import_event_eager_fallback(
247 writer, event, name=name, ctx=_ctx)
248 except _core._SymbolicException:
249 pass # Add nodes to the TensorFlow graph.
250 # Add nodes to the TensorFlow graph.
251 _, _, _op, _outputs = _op_def_library._apply_op_helper(
252 "ImportEvent", writer=writer, event=event, name=name)
253 return _op
254ImportEvent = tf_export("raw_ops.ImportEvent")(_ops.to_raw_op(import_event))
257def import_event_eager_fallback(writer, event, name, ctx):
258 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
259 event = _ops.convert_to_tensor(event, _dtypes.string)
260 _inputs_flat = [writer, event]
261 _attrs = None
262 _result = _execute.execute(b"ImportEvent", 0, inputs=_inputs_flat,
263 attrs=_attrs, ctx=ctx, name=name)
264 _result = None
265 return _result
268def summary_writer(shared_name="", container="", name=None):
269 r"""TODO: add doc.
271 Args:
272 shared_name: An optional `string`. Defaults to `""`.
273 container: An optional `string`. Defaults to `""`.
274 name: A name for the operation (optional).
276 Returns:
277 A `Tensor` of type `resource`.
278 """
279 _ctx = _context._context or _context.context()
280 tld = _ctx._thread_local_data
281 if tld.is_eager:
282 try:
283 _result = pywrap_tfe.TFE_Py_FastPathExecute(
284 _ctx, "SummaryWriter", name, "shared_name", shared_name, "container",
285 container)
286 return _result
287 except _core._NotOkStatusException as e:
288 _ops.raise_from_not_ok_status(e, name)
289 except _core._FallbackException:
290 pass
291 try:
292 return summary_writer_eager_fallback(
293 shared_name=shared_name, container=container, name=name, ctx=_ctx)
294 except _core._SymbolicException:
295 pass # Add nodes to the TensorFlow graph.
296 # Add nodes to the TensorFlow graph.
297 if shared_name is None:
298 shared_name = ""
299 shared_name = _execute.make_str(shared_name, "shared_name")
300 if container is None:
301 container = ""
302 container = _execute.make_str(container, "container")
303 _, _, _op, _outputs = _op_def_library._apply_op_helper(
304 "SummaryWriter", shared_name=shared_name, container=container,
305 name=name)
306 _result = _outputs[:]
307 if _execute.must_record_gradient():
308 _attrs = ("shared_name", _op.get_attr("shared_name"), "container",
309 _op.get_attr("container"))
310 _inputs_flat = _op.inputs
311 _execute.record_gradient(
312 "SummaryWriter", _inputs_flat, _attrs, _result)
313 _result, = _result
314 return _result
316SummaryWriter = tf_export("raw_ops.SummaryWriter")(_ops.to_raw_op(summary_writer))
319def summary_writer_eager_fallback(shared_name, container, name, ctx):
320 if shared_name is None:
321 shared_name = ""
322 shared_name = _execute.make_str(shared_name, "shared_name")
323 if container is None:
324 container = ""
325 container = _execute.make_str(container, "container")
326 _inputs_flat = []
327 _attrs = ("shared_name", shared_name, "container", container)
328 _result = _execute.execute(b"SummaryWriter", 1, inputs=_inputs_flat,
329 attrs=_attrs, ctx=ctx, name=name)
330 if _execute.must_record_gradient():
331 _execute.record_gradient(
332 "SummaryWriter", _inputs_flat, _attrs, _result)
333 _result, = _result
334 return _result
337def write_audio_summary(writer, step, tag, tensor, sample_rate, max_outputs=3, name=None):
338 r"""Writes an audio summary.
340 Writes encoded audio summary `tensor` at `step` with `tag` using summary `writer`.
341 `sample_rate` is the audio sample rate is Hz.
343 Args:
344 writer: A `Tensor` of type `resource`.
345 step: A `Tensor` of type `int64`.
346 tag: A `Tensor` of type `string`.
347 tensor: A `Tensor` of type `float32`.
348 sample_rate: A `Tensor` of type `float32`.
349 max_outputs: An optional `int` that is `>= 1`. Defaults to `3`.
350 name: A name for the operation (optional).
352 Returns:
353 The created Operation.
354 """
355 _ctx = _context._context or _context.context()
356 tld = _ctx._thread_local_data
357 if tld.is_eager:
358 try:
359 _result = pywrap_tfe.TFE_Py_FastPathExecute(
360 _ctx, "WriteAudioSummary", name, writer, step, tag, tensor,
361 sample_rate, "max_outputs", max_outputs)
362 return _result
363 except _core._NotOkStatusException as e:
364 _ops.raise_from_not_ok_status(e, name)
365 except _core._FallbackException:
366 pass
367 try:
368 return write_audio_summary_eager_fallback(
369 writer, step, tag, tensor, sample_rate, max_outputs=max_outputs,
370 name=name, ctx=_ctx)
371 except _core._SymbolicException:
372 pass # Add nodes to the TensorFlow graph.
373 # Add nodes to the TensorFlow graph.
374 if max_outputs is None:
375 max_outputs = 3
376 max_outputs = _execute.make_int(max_outputs, "max_outputs")
377 _, _, _op, _outputs = _op_def_library._apply_op_helper(
378 "WriteAudioSummary", writer=writer, step=step, tag=tag, tensor=tensor,
379 sample_rate=sample_rate, max_outputs=max_outputs,
380 name=name)
381 return _op
382WriteAudioSummary = tf_export("raw_ops.WriteAudioSummary")(_ops.to_raw_op(write_audio_summary))
385def write_audio_summary_eager_fallback(writer, step, tag, tensor, sample_rate, max_outputs, name, ctx):
386 if max_outputs is None:
387 max_outputs = 3
388 max_outputs = _execute.make_int(max_outputs, "max_outputs")
389 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
390 step = _ops.convert_to_tensor(step, _dtypes.int64)
391 tag = _ops.convert_to_tensor(tag, _dtypes.string)
392 tensor = _ops.convert_to_tensor(tensor, _dtypes.float32)
393 sample_rate = _ops.convert_to_tensor(sample_rate, _dtypes.float32)
394 _inputs_flat = [writer, step, tag, tensor, sample_rate]
395 _attrs = ("max_outputs", max_outputs)
396 _result = _execute.execute(b"WriteAudioSummary", 0, inputs=_inputs_flat,
397 attrs=_attrs, ctx=ctx, name=name)
398 _result = None
399 return _result
402def write_graph_summary(writer, step, tensor, name=None):
403 r"""Writes a graph summary.
405 Writes TensorFlow graph `tensor` at `step` using summary `writer`.
407 Args:
408 writer: A `Tensor` of type `resource`.
409 step: A `Tensor` of type `int64`.
410 tensor: A `Tensor` of type `string`.
411 name: A name for the operation (optional).
413 Returns:
414 The created Operation.
415 """
416 _ctx = _context._context or _context.context()
417 tld = _ctx._thread_local_data
418 if tld.is_eager:
419 try:
420 _result = pywrap_tfe.TFE_Py_FastPathExecute(
421 _ctx, "WriteGraphSummary", name, writer, step, tensor)
422 return _result
423 except _core._NotOkStatusException as e:
424 _ops.raise_from_not_ok_status(e, name)
425 except _core._FallbackException:
426 pass
427 try:
428 return write_graph_summary_eager_fallback(
429 writer, step, tensor, name=name, ctx=_ctx)
430 except _core._SymbolicException:
431 pass # Add nodes to the TensorFlow graph.
432 # Add nodes to the TensorFlow graph.
433 _, _, _op, _outputs = _op_def_library._apply_op_helper(
434 "WriteGraphSummary", writer=writer, step=step, tensor=tensor,
435 name=name)
436 return _op
437WriteGraphSummary = tf_export("raw_ops.WriteGraphSummary")(_ops.to_raw_op(write_graph_summary))
440def write_graph_summary_eager_fallback(writer, step, tensor, name, ctx):
441 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
442 step = _ops.convert_to_tensor(step, _dtypes.int64)
443 tensor = _ops.convert_to_tensor(tensor, _dtypes.string)
444 _inputs_flat = [writer, step, tensor]
445 _attrs = None
446 _result = _execute.execute(b"WriteGraphSummary", 0, inputs=_inputs_flat,
447 attrs=_attrs, ctx=ctx, name=name)
448 _result = None
449 return _result
452def write_histogram_summary(writer, step, tag, values, name=None):
453 r"""Writes a histogram summary.
455 Writes histogram `values` at `step` with `tag` using summary `writer`.
457 Args:
458 writer: A `Tensor` of type `resource`.
459 step: A `Tensor` of type `int64`.
460 tag: A `Tensor` of type `string`.
461 values: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `int64`, `bfloat16`, `uint16`, `half`, `uint32`, `uint64`, `bool`.
462 name: A name for the operation (optional).
464 Returns:
465 The created Operation.
466 """
467 _ctx = _context._context or _context.context()
468 tld = _ctx._thread_local_data
469 if tld.is_eager:
470 try:
471 _result = pywrap_tfe.TFE_Py_FastPathExecute(
472 _ctx, "WriteHistogramSummary", name, writer, step, tag, values)
473 return _result
474 except _core._NotOkStatusException as e:
475 _ops.raise_from_not_ok_status(e, name)
476 except _core._FallbackException:
477 pass
478 try:
479 return write_histogram_summary_eager_fallback(
480 writer, step, tag, values, name=name, ctx=_ctx)
481 except _core._SymbolicException:
482 pass # Add nodes to the TensorFlow graph.
483 # Add nodes to the TensorFlow graph.
484 _, _, _op, _outputs = _op_def_library._apply_op_helper(
485 "WriteHistogramSummary", writer=writer, step=step, tag=tag,
486 values=values, name=name)
487 return _op
488WriteHistogramSummary = tf_export("raw_ops.WriteHistogramSummary")(_ops.to_raw_op(write_histogram_summary))
491def write_histogram_summary_eager_fallback(writer, step, tag, values, name, ctx):
492 _attr_T, (values,) = _execute.args_to_matching_eager([values], ctx, [_dtypes.float32, _dtypes.float64, _dtypes.int32, _dtypes.uint8, _dtypes.int16, _dtypes.int8, _dtypes.int64, _dtypes.bfloat16, _dtypes.uint16, _dtypes.half, _dtypes.uint32, _dtypes.uint64, _dtypes.bool, ], _dtypes.float32)
493 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
494 step = _ops.convert_to_tensor(step, _dtypes.int64)
495 tag = _ops.convert_to_tensor(tag, _dtypes.string)
496 _inputs_flat = [writer, step, tag, values]
497 _attrs = ("T", _attr_T)
498 _result = _execute.execute(b"WriteHistogramSummary", 0, inputs=_inputs_flat,
499 attrs=_attrs, ctx=ctx, name=name)
500 _result = None
501 return _result
504def write_image_summary(writer, step, tag, tensor, bad_color, max_images=3, name=None):
505 r"""Writes an image summary.
507 Writes image `tensor` at `step` with `tag` using summary `writer`.
508 `tensor` is image with shape [height, width, channels].
510 Args:
511 writer: A `Tensor` of type `resource`.
512 step: A `Tensor` of type `int64`.
513 tag: A `Tensor` of type `string`.
514 tensor: A `Tensor`. Must be one of the following types: `uint8`, `float64`, `float32`, `half`.
515 bad_color: A `Tensor` of type `uint8`.
516 max_images: An optional `int` that is `>= 1`. Defaults to `3`.
517 name: A name for the operation (optional).
519 Returns:
520 The created Operation.
521 """
522 _ctx = _context._context or _context.context()
523 tld = _ctx._thread_local_data
524 if tld.is_eager:
525 try:
526 _result = pywrap_tfe.TFE_Py_FastPathExecute(
527 _ctx, "WriteImageSummary", name, writer, step, tag, tensor, bad_color,
528 "max_images", max_images)
529 return _result
530 except _core._NotOkStatusException as e:
531 _ops.raise_from_not_ok_status(e, name)
532 except _core._FallbackException:
533 pass
534 try:
535 return write_image_summary_eager_fallback(
536 writer, step, tag, tensor, bad_color, max_images=max_images,
537 name=name, ctx=_ctx)
538 except _core._SymbolicException:
539 pass # Add nodes to the TensorFlow graph.
540 # Add nodes to the TensorFlow graph.
541 if max_images is None:
542 max_images = 3
543 max_images = _execute.make_int(max_images, "max_images")
544 _, _, _op, _outputs = _op_def_library._apply_op_helper(
545 "WriteImageSummary", writer=writer, step=step, tag=tag, tensor=tensor,
546 bad_color=bad_color, max_images=max_images,
547 name=name)
548 return _op
549WriteImageSummary = tf_export("raw_ops.WriteImageSummary")(_ops.to_raw_op(write_image_summary))
552def write_image_summary_eager_fallback(writer, step, tag, tensor, bad_color, max_images, name, ctx):
553 if max_images is None:
554 max_images = 3
555 max_images = _execute.make_int(max_images, "max_images")
556 _attr_T, (tensor,) = _execute.args_to_matching_eager([tensor], ctx, [_dtypes.uint8, _dtypes.float64, _dtypes.float32, _dtypes.half, ], _dtypes.float32)
557 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
558 step = _ops.convert_to_tensor(step, _dtypes.int64)
559 tag = _ops.convert_to_tensor(tag, _dtypes.string)
560 bad_color = _ops.convert_to_tensor(bad_color, _dtypes.uint8)
561 _inputs_flat = [writer, step, tag, tensor, bad_color]
562 _attrs = ("max_images", max_images, "T", _attr_T)
563 _result = _execute.execute(b"WriteImageSummary", 0, inputs=_inputs_flat,
564 attrs=_attrs, ctx=ctx, name=name)
565 _result = None
566 return _result
569def write_raw_proto_summary(writer, step, tensor, name=None):
570 r"""Writes a serialized proto summary.
572 Writes `tensor`, a serialized proto at `step` using summary `writer`.
574 Args:
575 writer: A `Tensor` of type `resource`.
576 step: A `Tensor` of type `int64`.
577 tensor: A `Tensor` of type `string`.
578 name: A name for the operation (optional).
580 Returns:
581 The created Operation.
582 """
583 _ctx = _context._context or _context.context()
584 tld = _ctx._thread_local_data
585 if tld.is_eager:
586 try:
587 _result = pywrap_tfe.TFE_Py_FastPathExecute(
588 _ctx, "WriteRawProtoSummary", name, writer, step, tensor)
589 return _result
590 except _core._NotOkStatusException as e:
591 _ops.raise_from_not_ok_status(e, name)
592 except _core._FallbackException:
593 pass
594 try:
595 return write_raw_proto_summary_eager_fallback(
596 writer, step, tensor, name=name, ctx=_ctx)
597 except _core._SymbolicException:
598 pass # Add nodes to the TensorFlow graph.
599 # Add nodes to the TensorFlow graph.
600 _, _, _op, _outputs = _op_def_library._apply_op_helper(
601 "WriteRawProtoSummary", writer=writer, step=step, tensor=tensor,
602 name=name)
603 return _op
604WriteRawProtoSummary = tf_export("raw_ops.WriteRawProtoSummary")(_ops.to_raw_op(write_raw_proto_summary))
607def write_raw_proto_summary_eager_fallback(writer, step, tensor, name, ctx):
608 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
609 step = _ops.convert_to_tensor(step, _dtypes.int64)
610 tensor = _ops.convert_to_tensor(tensor, _dtypes.string)
611 _inputs_flat = [writer, step, tensor]
612 _attrs = None
613 _result = _execute.execute(b"WriteRawProtoSummary", 0, inputs=_inputs_flat,
614 attrs=_attrs, ctx=ctx, name=name)
615 _result = None
616 return _result
619def write_scalar_summary(writer, step, tag, value, name=None):
620 r"""Writes a scalar summary.
622 Writes scalar `value` at `step` with `tag` using summary `writer`.
624 Args:
625 writer: A `Tensor` of type `resource`.
626 step: A `Tensor` of type `int64`.
627 tag: A `Tensor` of type `string`.
628 value: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `uint8`, `int16`, `int8`, `int64`, `bfloat16`, `uint16`, `half`, `uint32`, `uint64`.
629 name: A name for the operation (optional).
631 Returns:
632 The created Operation.
633 """
634 _ctx = _context._context or _context.context()
635 tld = _ctx._thread_local_data
636 if tld.is_eager:
637 try:
638 _result = pywrap_tfe.TFE_Py_FastPathExecute(
639 _ctx, "WriteScalarSummary", name, writer, step, tag, value)
640 return _result
641 except _core._NotOkStatusException as e:
642 _ops.raise_from_not_ok_status(e, name)
643 except _core._FallbackException:
644 pass
645 try:
646 return write_scalar_summary_eager_fallback(
647 writer, step, tag, value, name=name, ctx=_ctx)
648 except _core._SymbolicException:
649 pass # Add nodes to the TensorFlow graph.
650 # Add nodes to the TensorFlow graph.
651 _, _, _op, _outputs = _op_def_library._apply_op_helper(
652 "WriteScalarSummary", writer=writer, step=step, tag=tag, value=value,
653 name=name)
654 return _op
655WriteScalarSummary = tf_export("raw_ops.WriteScalarSummary")(_ops.to_raw_op(write_scalar_summary))
658def write_scalar_summary_eager_fallback(writer, step, tag, value, name, ctx):
659 _attr_T, (value,) = _execute.args_to_matching_eager([value], ctx, [_dtypes.float32, _dtypes.float64, _dtypes.int32, _dtypes.uint8, _dtypes.int16, _dtypes.int8, _dtypes.int64, _dtypes.bfloat16, _dtypes.uint16, _dtypes.half, _dtypes.uint32, _dtypes.uint64, ])
660 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
661 step = _ops.convert_to_tensor(step, _dtypes.int64)
662 tag = _ops.convert_to_tensor(tag, _dtypes.string)
663 _inputs_flat = [writer, step, tag, value]
664 _attrs = ("T", _attr_T)
665 _result = _execute.execute(b"WriteScalarSummary", 0, inputs=_inputs_flat,
666 attrs=_attrs, ctx=ctx, name=name)
667 _result = None
668 return _result
671def write_summary(writer, step, tensor, tag, summary_metadata, name=None):
672 r"""Writes a tensor summary.
674 Writes `tensor` at `step` with `tag` using summary `writer`.
676 Args:
677 writer: A `Tensor` of type `resource`.
678 step: A `Tensor` of type `int64`.
679 tensor: A `Tensor`.
680 tag: A `Tensor` of type `string`.
681 summary_metadata: A `Tensor` of type `string`.
682 name: A name for the operation (optional).
684 Returns:
685 The created Operation.
686 """
687 _ctx = _context._context or _context.context()
688 tld = _ctx._thread_local_data
689 if tld.is_eager:
690 try:
691 _result = pywrap_tfe.TFE_Py_FastPathExecute(
692 _ctx, "WriteSummary", name, writer, step, tensor, tag,
693 summary_metadata)
694 return _result
695 except _core._NotOkStatusException as e:
696 _ops.raise_from_not_ok_status(e, name)
697 except _core._FallbackException:
698 pass
699 try:
700 return write_summary_eager_fallback(
701 writer, step, tensor, tag, summary_metadata, name=name, ctx=_ctx)
702 except _core._SymbolicException:
703 pass # Add nodes to the TensorFlow graph.
704 # Add nodes to the TensorFlow graph.
705 _, _, _op, _outputs = _op_def_library._apply_op_helper(
706 "WriteSummary", writer=writer, step=step, tensor=tensor, tag=tag,
707 summary_metadata=summary_metadata, name=name)
708 return _op
709WriteSummary = tf_export("raw_ops.WriteSummary")(_ops.to_raw_op(write_summary))
712def write_summary_eager_fallback(writer, step, tensor, tag, summary_metadata, name, ctx):
713 _attr_T, (tensor,) = _execute.args_to_matching_eager([tensor], ctx, [])
714 writer = _ops.convert_to_tensor(writer, _dtypes.resource)
715 step = _ops.convert_to_tensor(step, _dtypes.int64)
716 tag = _ops.convert_to_tensor(tag, _dtypes.string)
717 summary_metadata = _ops.convert_to_tensor(summary_metadata, _dtypes.string)
718 _inputs_flat = [writer, step, tensor, tag, summary_metadata]
719 _attrs = ("T", _attr_T)
720 _result = _execute.execute(b"WriteSummary", 0, inputs=_inputs_flat,
721 attrs=_attrs, ctx=ctx, name=name)
722 _result = None
723 return _result