def write_summary(base_dir: Path, aggregations_per_tag) -> None:
    writer = FileWriter(base_dir)

    for tag, (steps, wall_times, aggregations) in aggregations_per_tag.items():
        for wall_time, step, aggregation in zip(steps, wall_times,
                                                aggregations):
            summary = Summary(
                value=[Summary.Value(tag=tag, simple_value=aggregation)])
            scalar_event = Event(wall_time=wall_time,
                                 step=step,
                                 summary=summary)
            writer.add_event(scalar_event)

        writer.flush()
Beispiel #2
0
def write_summary(base_dir: Path, aggregations_per_tag) -> None:
    # remove existing files
    for path in base_dir.glob('events.out.tfevents.*'):
        os.remove(str(path))

    writer = FileWriter(base_dir)

    for tag, (steps, wall_times, aggregations) in aggregations_per_tag.items():
        for wall_time, step, aggregation in zip(steps, wall_times,
                                                aggregations):
            summary = Summary(
                value=[Summary.Value(tag=tag, simple_value=aggregation)])
            scalar_event = Event(wall_time=wall_time,
                                 step=step,
                                 summary=summary)
            writer.add_event(scalar_event)

        writer.flush()