writer.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:tensorboard 作者: dmlc 项目源码 文件源码
def __init__(self, log_dir=None, comment=''):
        """
        Args:
            log_dir (string): save location, default is: runs/**CURRENT_DATETIME_HOSTNAME**, which changes after each run. Use hierarchical folder structure to compare between runs easily. e.g. 'runs/exp1', 'runs/exp2'
            comment (string): comment that appends to the default log_dir
        """
        if log_dir == None:
            import socket
            from datetime import datetime
            log_dir = os.path.join('runs',
                                   datetime.now().strftime('%b%d_%H-%M-%S') + '_' + socket.gethostname() + comment)
        self.file_writer = FileWriter(logdir=log_dir)
        v = 1E-12
        buckets = []
        neg_buckets = []
        while v < 1E20:
            buckets.append(v)
            neg_buckets.append(-v)
            v *= 1.1
        self.default_bins = neg_buckets[::-1] + [0] + buckets
        self.text_tags = []
        #
        self.all_writers = {self.file_writer.get_logdir(): self.file_writer}
        self.scalar_dict = {}  # {writer_id : [[timestamp, step, value],...],...}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号