Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolai256 authored Oct 17, 2022
1 parent 737b34d commit c5fb142
Show file tree
Hide file tree
Showing 2 changed files with 265 additions and 270 deletions.
8 changes: 5 additions & 3 deletions logger.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import tensorflow as tf
from tensorflow import summary
import os
import shutil


class Logger(object):
def __init__(self, log_dir, suffix=None):
"""Create a summary writer logging to log_dir."""
self.writer = tf.compat.v1.summary.FileWriter(log_dir, filename_suffix=suffix)
self.writer = tf.summary.create_file_writer(log_dir, filename_suffix=suffix)

def scalar_summary(self, tag, value, step):
"""Log a scalar variable."""
summary = tf.Summary(value=[tf.Summary.Value(tag=tag, simple_value=value)])
self.writer.add_summary(summary, step)
with self.writer.as_default():
tf.summary.scalar(tag, value, step=step)
self.writer.flush()


class ModelLogger(object):
Expand Down
Loading

0 comments on commit c5fb142

Please sign in to comment.