tf.summary.experimental.summary_scope
Stay organized with collections
Save and categorize content based on your preferences.
Experimental context manager for use when defining a custom summary op.
@tf_contextlib.contextmanager
tf.summary.experimental.summary_scope(
name, default_name='summary', values=None
)
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 with enclosing
name scopes if any - but we relax the constraint that it be uniquified, as
well as the character set limitation (so the user-provided name can contain
characters not legal for scope names; in the scope name these are removed).
This makes the summary tag more predictable and consistent for the user.
For example, to define a new summary op called my_op
:
def my_op(name, my_value, step):
with tf.summary.summary_scope(name, "MyOp", [my_value]) as (tag, scope):
my_value = tf.convert_to_tensor(my_value)
return tf.summary.write(tag, my_value, step=step)
Args |
name
|
string name for the summary.
|
default_name
|
Optional; if provided, used as default name of the summary.
|
values
|
Optional; passed as values parameter to name_scope.
|
Yields |
A tuple (tag, scope) as described above.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.summary.experimental.summary_scope\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/ops/summary_ops_v2.py#L691-L729) |\n\nExperimental context manager for use when defining a custom summary op. \n\n @tf_contextlib.contextmanager\n tf.summary.experimental.summary_scope(\n name, default_name='summary', values=None\n )\n\nThis behaves similarly to [`tf.name_scope`](../../../tf/name_scope), except that it returns a generated\nsummary tag in addition to the scope name. The tag is structurally similar to\nthe scope name - derived from the user-provided name, prefixed with enclosing\nname scopes if any - but we relax the constraint that it be uniquified, as\nwell as the character set limitation (so the user-provided name can contain\ncharacters not legal for scope names; in the scope name these are removed).\n\nThis makes the summary tag more predictable and consistent for the user.\n\nFor example, to define a new summary op called `my_op`: \n\n def my_op(name, my_value, step):\n with tf.summary.summary_scope(name, \"MyOp\", [my_value]) as (tag, scope):\n my_value = tf.convert_to_tensor(my_value)\n return tf.summary.write(tag, my_value, step=step)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|-------------------------------------------------------------|\n| `name` | string name for the summary. |\n| `default_name` | Optional; if provided, used as default name of the summary. |\n| `values` | Optional; passed as `values` parameter to name_scope. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Yields ------ ||\n|---|---|\n| A tuple `(tag, scope)` as described above. ||\n\n\u003cbr /\u003e"]]