1

I want to create two different collection for summaries. One is for training summary and one is for validation summary.

So i can use two different merge_all operation to store the value

merge_all(key=tf.GraphKeys.SUMMARIES)

The function scalar can be added to a collection.

tf.summary.scalar(
    name,
    tensor,
    collections=None,
    family=None
)

how to create a new collection for summaries?

S. Ricci
  • 181
  • 11
  • 1
    Maybe that would help: https://stackoverflow.com/questions/40722413/how-to-use-several-summary-collections-in-tensorflow – y.selivonchyk Oct 19 '17 at 21:20

1 Answers1

2

It should be possible to use an arbitrary string value as the key. It might look something like this:

tf.summary.scalar('tag_a', ...)
tf.summary.scalar('tag_b', ..., collections=["foo"])
merged_a = tf.summary.merge_all()
merged_b = tf.summary.merge_all(key="foo")
writer_a = tf.summary.FileWriter(log_dir + '/collection_a')
writer_b = tf.summary.FileWriter(log_dir + '/collection_b')
for step in range(1000):
  summary_a, summary_b = sess.run([merged_a, merged_b], ...)
  writer_a.add_summary(summary_a, step)
  writer_b.add_summary(summary_b, step)

It's worth mentioning that normally people will configure things in a way where there's one merge_all operation and multiple run calls. For example: https://github.com/tensorflow/tensorflow/blob/cf7c008ab150ac8e5edb3ed053d38b2919699796/tensorflow/examples/tutorials/mnist/mnist_with_summaries.py#L142 Even if the summary series are broken up using the collections parameter, TensorBoard would still visually represent them as if they're different runs. Please also note that the name parameter corresponds to each chart (tag) within a run.

Justine Tunney
  • 532
  • 3
  • 10