Google I / Oが5月18〜20日に戻ってきます。スペースを予約してスケジュールを作成する今すぐ登録する

tff.simulation.TensorBoardManager

Utility class for saving metrics using tf.summary.

Inherits From: MetricsManager

This class is intended to log metrics so that they can be used with TensorBoard. Note that this supports both scalar and series data, which are logged via tf.summary.scalar and tf.summary.histogram, respectively.

summary_dir A path on the filesystem containing all outputs of the associated summary writer.

ValueError If root_metrics_dir is an empty string.
ValueError If summary_dir is an empty string.

Methods

update_metrics

View source

Updates the stored metrics data with metrics for a specific round.

The specified round_num must be later than the latest round number previously used with update_metrics. Note that we do not check whether the underlying summary writer has previously written any metrics with the given round_num. Thus, if the TensorboardManager is created from a directory containing previously written metrics, it may overwrite them. This is intended usage, allowing one to restart and resume experiments from previous rounds.

The metrics written by the underlying tf.summary.SummaryWriter will be the leaf node tensors of the metrics_to_append structure. Purely scalar tensors will be written using tf.summary.scalar, while tensors with non-zero rank will be written using tf.summary.histogram.

Args
round_num Communication round at which metrics_to_append was collected.
metrics_to_append A nested structure of metrics collected during round_num. The nesting will be flattened for purposes of writing to TensorBoard.

Returns
A collections.OrderedDict of the metrics used to update the manager. Compared with the input metrics_to_append, this data is flattened, with the key names equal to the path in the nested structure, and round_num has been added as an additional key (overwriting the value if already present in the input metrics_to_append). The OrderedDict is sorted by the flattened keys.

Raises
ValueError If the provided round number is negative.
ValueError If the provided round number is less than or equal to the last round number used with update_metrics.