orbit.utils.SummaryManager

A utility class for managing summary writing.

Inherits From: SummaryManagerInterface

summary_dir The directory in which to write summaries. If None, all summary writing operations provided by this class are no-ops.
summary_fn A callable defined accepting name, value, and step parameters, making calls to tf.summary functions to write summaries.
global_step A tf.Variable containing the global step value.

Methods

flush

View source

Flushes the underlying summary writers.

summary_writer

View source

Returns the underlying summary writer for a specific subdirectory.

Args
relative_path The current path in which to write summaries, relative to the summary directory. By default it is empty, which corresponds to the root directory.

write_summaries

View source

Writes summaries for the given dictionary of values.

This recursively creates subdirectories for any nested dictionaries provided in summary_dict, yielding a hierarchy of directories which will then be reflected in the TensorBoard UI as different colored curves.

For example, users may evaluate on multiple datasets and return summary_dict as a nested dictionary:

{
    "dataset1": {
        "loss": loss1,
        "accuracy": accuracy1
    },
    "dataset2": {
        "loss": loss2,
        "accuracy": accuracy2
    },
}

This will create two subdirectories, "dataset1" and "dataset2", inside the summary root directory. Each directory will contain event files including both "loss" and "accuracy" summaries.

Args
summary_dict A dictionary of values. If any value in summary_dict is itself a dictionary, then the function will create a subdirectory with name given by the corresponding key. This is performed recursively. Leaf values are then summarized using the summary writer instance specific to the parent relative path.