<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.21.0/tensorflow/python/ops/summary_ops_v2.py#L700-L738) |

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`](https://www.tensorflow.org/api_docs/python/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)

<br />

<br />

<br />

| ## 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. |

<br />

<br />

<br />

<br />

| ## Yields ||
|---|---|
| A tuple `(tag, scope)` as described above. ||

<br />