forked from yunjey/stargan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogger.py
32 lines (23 loc) · 984 Bytes
/
logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# import tensorflow as tf
# class Logger(object):
# """Tensorboard logger."""
# def __init__(self, log_dir):
# """Initialize summary writer."""
# #self.writer = tf.summary.FileWriter(log_dir)
# self.writer = tf.summary.create_file_writer(log_dir)
# def scalar_summary(self, tag, value, step):
# """Add scalar summary."""
# summary = tf.Summary(value=[tf.Summary.Value(tag=tag, simple_value=value)])
# self.writer.add_summary(summary, step)
#import tensorflow as tf
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
class Logger(object):
"""Tensorboard logger."""
def __init__(self, log_dir):
"""Initialize summary writer."""
self.writer = tf.summary.FileWriter(log_dir)
def scalar_summary(self, tag, value, step):
"""Add scalar summary."""
summary = tf.Summary(value=[tf.Summary.Value(tag=tag, simple_value=value)])
self.writer.add_summary(summary, step)