This API is not compatible with eager execution or tf.function. To migrate
to TF2, this API can be omitted entirely, because in TF2 individual summary
ops, like tf.summary.scalar(), write directly to the default summary writer
if one is active. Thus, it's not necessary to merge summaries or to manually
add the resulting merged summary output to the writer. See the usage example
shown below.
GraphKey used to collect the summaries. Defaults to
GraphKeys.SUMMARIES.
scope
Optional scope used to filter the summary ops, using re.match.
name
A name for the operation (optional).
Returns
If no summaries were collected, returns None. Otherwise returns a scalar
Tensor of type string containing the serialized Summary protocol
buffer resulting from the merging.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.summary.merge_all\n\n\u003cbr /\u003e\n\n|-------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.16.1/tensorflow/python/summary/summary.py#L693-L760) |\n\nMerges all summaries collected in the default graph. \n\n tf.compat.v1.summary.merge_all(\n key=_ops.GraphKeys.SUMMARIES, scope=None, name=None\n )\n\n\u003cbr /\u003e\n\nMigrate to TF2\n--------------\n\n\u003cbr /\u003e\n\n| **Caution:** This API was designed for TensorFlow v1. Continue reading for details on how to migrate from this API to a native TensorFlow v2 equivalent. See the [TensorFlow v1 to TensorFlow v2 migration guide](https://www.tensorflow.org/guide/migrate) for instructions on how to migrate the rest of your code.\n\nThis API is not compatible with eager execution or [`tf.function`](../../../../tf/function). To migrate\nto TF2, this API can be omitted entirely, because in TF2 individual summary\nops, like [`tf.summary.scalar()`](../../../../tf/summary/scalar), write directly to the default summary writer\nif one is active. Thus, it's not necessary to merge summaries or to manually\nadd the resulting merged summary output to the writer. See the usage example\nshown below.\n\nFor a comprehensive [`tf.summary`](../../../../tf/summary) migration guide, please follow\n[Migrating tf.summary usage to\nTF 2.0](https://www.tensorflow.org/tensorboard/migrate#in_tf_1x).\n\n#### TF1 \\& TF2 Usage Example\n\nTF1: \n\n dist = tf.compat.v1.placeholder(tf.float32, [100])\n tf.compat.v1.summary.histogram(name=\"distribution\", values=dist)\n writer = tf.compat.v1.summary.FileWriter(\"/tmp/tf1_summary_example\")\n summaries = tf.compat.v1.summary.merge_all()\n\n sess = tf.compat.v1.Session()\n for step in range(100):\n mean_moving_normal = np.random.normal(loc=step, scale=1, size=[100])\n summ = sess.run(summaries, feed_dict={dist: mean_moving_normal})\n writer.add_summary(summ, global_step=step)\n\nTF2: \n\n writer = tf.summary.create_file_writer(\"/tmp/tf2_summary_example\")\n for step in range(100):\n mean_moving_normal = np.random.normal(loc=step, scale=1, size=[100])\n with writer.as_default(step=step):\n tf.summary.histogram(name='distribution', data=mean_moving_normal)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nDescription\n-----------\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------|------------------------------------------------------------------------------|\n| `key` | `GraphKey` used to collect the summaries. Defaults to `GraphKeys.SUMMARIES`. |\n| `scope` | Optional scope used to filter the summary ops, using `re.match`. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| If no summaries were collected, returns None. Otherwise returns a scalar `Tensor` of type `string` containing the serialized `Summary` protocol buffer resulting from the merging. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ------ ||\n|----------------|-----------------------------------------|\n| `RuntimeError` | If called with eager execution enabled. |\n\n\u003cbr /\u003e"]]