MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / summary_scope

Function summary_scope

tensorflow/python/ops/summary_ops_v2.py:550–586  ·  view source on GitHub ↗

Experimental context manager for use when defining a custom summary op. This behaves similarly to `tf.name_scope`, except that it returns a generated summary tag in addition to the scope name. The tag is structurally similar to the scope name - derived from the user-provided name, prefixed wi

(name, default_name="summary", values=None)

Source from the content-addressed store, hash-verified

548@tf_export("summary.experimental.summary_scope", v1=[])
549@tf_contextlib.contextmanager
550def summary_scope(name, default_name="summary", values=None):
551 """Experimental context manager for use when defining a custom summary op.
552
553 This behaves similarly to `tf.name_scope`, except that it returns a generated
554 summary tag in addition to the scope name. The tag is structurally similar to
555 the scope name - derived from the user-provided name, prefixed with enclosing
556 name scopes if any - but we relax the constraint that it be uniquified, as
557 well as the character set limitation (so the user-provided name can contain
558 characters not legal for scope names; in the scope name these are removed).
559
560 This makes the summary tag more predictable and consistent for the user.
561
562 For example, to define a new summary op called `my_op`:
563
564 ```python
565 def my_op(name, my_value, step):
566 with tf.summary.summary_scope(name, "MyOp", [my_value]) as (tag, scope):
567 my_value = tf.convert_to_tensor(my_value)
568 return tf.summary.write(tag, my_value, step=step)
569 ```
570
571 Args:
572 name: string name for the summary.
573 default_name: Optional; if provided, used as default name of the summary.
574 values: Optional; passed as `values` parameter to name_scope.
575
576 Yields:
577 A tuple `(tag, scope)` as described above.
578 """
579 name = name or default_name
580 current_scope = ops.get_name_scope()
581 tag = current_scope + "/" + name if current_scope else name
582 # Strip illegal characters from the scope name, and if that leaves nothing,
583 # use None instead so we pick up the default name.
584 name = _INVALID_SCOPE_CHARACTERS.sub("", name) or None
585 with ops.name_scope(name, default_name, values) as scope:
586 yield tag, scope
587
588
589@tf_export("summary.write", v1=[])

Callers 3

run_metadataFunction · 0.70
run_metadata_graphsFunction · 0.70
keras_modelFunction · 0.70

Calls 3

get_name_scopeMethod · 0.80
subMethod · 0.45
name_scopeMethod · 0.45

Tested by

no test coverage detected