当前位置: 首页>>代码示例>>Python>>正文


Python tensorboard.FileWriter方法代码示例

本文整理汇总了Python中tensorboard.FileWriter方法的典型用法代码示例。如果您正苦于以下问题:Python tensorboard.FileWriter方法的具体用法?Python tensorboard.FileWriter怎么用?Python tensorboard.FileWriter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tensorboard的用法示例。


在下文中一共展示了tensorboard.FileWriter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def __init__(self, output_dir):
        if cfg.TRAIN.FLAG:
            self.model_dir = os.path.join(output_dir, 'Model')
            self.image_dir = os.path.join(output_dir, 'Image')
            self.log_dir = os.path.join(output_dir, 'Log')
            mkdir_p(self.model_dir)
            mkdir_p(self.image_dir)
            mkdir_p(self.log_dir)
            self.summary_writer = FileWriter(self.log_dir)

        self.max_epoch = cfg.TRAIN.MAX_EPOCH
        self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL

        s_gpus = cfg.GPU_ID.split(',')
        self.gpus = [int(ix) for ix in s_gpus]
        self.num_gpus = len(self.gpus)
        self.batch_size = cfg.TRAIN.BATCH_SIZE * self.num_gpus
        torch.cuda.set_device(self.gpus[0])
        cudnn.benchmark = True

    # ############# For training stageI GAN ############# 
开发者ID:hanzhanggit,项目名称:StackGAN-Pytorch,代码行数:23,代码来源:trainer.py

示例2: __init__

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def __init__(self, output_dir):
        if cfg.TRAIN.FLAG:
            self.model_dir = os.path.join(output_dir, 'Model')
            self.image_dir = os.path.join(output_dir, 'Image')
            self.log_dir = os.path.join(output_dir, 'Log')
            mkdir_p(self.model_dir)
            mkdir_p(self.image_dir)
            mkdir_p(self.log_dir)
            self.summary_writer = FileWriter(self.log_dir)

        self.max_epoch = cfg.TRAIN.MAX_EPOCH
        self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL
        self.max_objects = 4

        s_gpus = cfg.GPU_ID.split(',')
        self.gpus = [int(ix) for ix in s_gpus]
        self.num_gpus = len(self.gpus)
        self.batch_size = cfg.TRAIN.BATCH_SIZE
        torch.cuda.set_device(self.gpus[0])
        cudnn.benchmark = True

    # ############# For training stageI GAN ############# 
开发者ID:tohinz,项目名称:multiple-objects-gan,代码行数:24,代码来源:trainer.py

示例3: __init__

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def __init__(self, output_dir):
        if cfg.TRAIN.FLAG:
            self.model_dir = os.path.join(output_dir, 'Model')
            self.image_dir = os.path.join(output_dir, 'Image')
            self.log_dir = os.path.join(output_dir, 'Log')
            mkdir_p(self.model_dir)
            mkdir_p(self.image_dir)
            mkdir_p(self.log_dir)
            self.summary_writer = FileWriter(self.log_dir)

        self.max_epoch = cfg.TRAIN.MAX_EPOCH
        self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL
        self.max_objects = 3

        s_gpus = cfg.GPU_ID.split(',')
        self.gpus = [int(ix) for ix in s_gpus]
        self.num_gpus = len(self.gpus)
        self.batch_size = cfg.TRAIN.BATCH_SIZE
        torch.cuda.set_device(self.gpus[0])
        cudnn.benchmark = True

    # ############# For training stageI GAN ############# 
开发者ID:tohinz,项目名称:multiple-objects-gan,代码行数:24,代码来源:trainer.py

示例4: __init__

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def __init__(self, output_dir):
        if cfg.TRAIN.FLAG:
            self.model_dir = os.path.join(output_dir, 'Model')
            self.image_dir = os.path.join(output_dir, 'Image')
            self.log_dir = os.path.join(output_dir, 'Log')
            mkdir_p(self.model_dir)
            mkdir_p(self.image_dir)
            mkdir_p(self.log_dir)
            self.summary_writer = FileWriter(self.log_dir)

        self.max_epoch = cfg.TRAIN.MAX_EPOCH
        self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL

        s_gpus = cfg.GPU_ID.split(',')
        self.gpus = [int(ix) for ix in s_gpus]
        self.num_gpus = len(self.gpus)
        self.batch_size = cfg.TRAIN.BATCH_SIZE
        torch.cuda.set_device(self.gpus[0])
        cudnn.benchmark = True

    # ############# For training stageI GAN ############# 
开发者ID:tohinz,项目名称:multiple-objects-gan,代码行数:23,代码来源:trainer.py

示例5: __init__

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def __init__(self, output_dir, data_loader, imsize):
        if cfg.TRAIN.FLAG:
            self.model_dir = os.path.join(output_dir, 'Model')
            self.image_dir = os.path.join(output_dir, 'Image')
            self.log_dir = os.path.join(output_dir, 'Log')
            mkdir_p(self.model_dir)
            mkdir_p(self.image_dir)
            mkdir_p(self.log_dir)
            self.summary_writer = FileWriter(self.log_dir)

        s_gpus = cfg.GPU_ID.split(',')
        self.gpus = [int(ix) for ix in s_gpus]
        self.num_gpus = len(self.gpus)
        torch.cuda.set_device(self.gpus[0])
        cudnn.benchmark = True

        self.batch_size = cfg.TRAIN.BATCH_SIZE * self.num_gpus
        self.max_epoch = cfg.TRAIN.MAX_EPOCH
        self.snapshot_interval = cfg.TRAIN.SNAPSHOT_INTERVAL

        self.data_loader = data_loader
        self.num_batches = len(self.data_loader) 
开发者ID:netanelyo,项目名称:Recipe2ImageGAN,代码行数:24,代码来源:blah.py

示例6: test_event_logging

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def test_event_logging():
    logdir = './experiment/'
    summary_writer = FileWriter(logdir)
    scalar_value = 1.0
    s = scalar('test_scalar', scalar_value)
    summary_writer.add_summary(s, global_step=1)
    summary_writer.close()
    assert os.path.isdir(logdir)
    assert len(os.listdir(logdir)) == 1

    summary_writer = FileWriter(logdir)
    scalar_value = 1.0
    s = scalar('test_scalar', scalar_value)
    summary_writer.add_summary(s, global_step=1)
    summary_writer.close()
    assert os.path.isdir(logdir)
    assert len(os.listdir(logdir)) == 2

    # clean up.
    shutil.rmtree(logdir) 
开发者ID:dmlc,项目名称:tensorboard,代码行数:22,代码来源:test_logging.py

示例7: __init__

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def __init__(self, logging_dir, logfile_name, print_freq = 10):

        self.log_dir = logging_dir
        self.print_freq = print_freq

        if not os.path.isdir(logging_dir):
            os.makedirs(logging_dir)

        self.summary_writer = tensorboard.FileWriter(logdir=logging_dir)

        # standard logger to print to terminal
        logfile = osp.join(logging_dir,'log.txt')
        stdout = Logger(logfile)
        sys.stdout = stdout 
开发者ID:lvzhaoyang,项目名称:DeeperInverseCompositionalAlgorithm,代码行数:16,代码来源:Logger.py

示例8: test_log_scalar_summary

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def test_log_scalar_summary():
    logdir = './experiment/scalar'
    writer = FileWriter(logdir)
    for i in range(10):
        s = scalar('scalar', i)
        writer.add_summary(s, i+1)
    writer.flush()
    writer.close() 
开发者ID:dmlc,项目名称:tensorboard,代码行数:10,代码来源:test_scalar.py

示例9: test_log_histogram_summary

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def test_log_histogram_summary():
    logdir = './experiment/histogram'
    writer = FileWriter(logdir)
    for i in range(10):
        mu, sigma = i * 0.1, 1.0
        values = np.random.normal(mu, sigma, 10000)  # larger for better looking.
        hist = summary.histogram('discrete_normal', values)
        writer.add_summary(hist, i+1)
    writer.flush()
    writer.close() 
开发者ID:dmlc,项目名称:tensorboard,代码行数:12,代码来源:test_histogram.py

示例10: test_log_image_summary

# 需要导入模块: import tensorboard [as 别名]
# 或者: from tensorboard import FileWriter [as 别名]
def test_log_image_summary():
    logdir = './experiment/image'
    writer = FileWriter(logdir)

    path = 'http://yann.lecun.com/exdb/mnist/'
    (train_lbl, train_img) = read_data(
        path+'train-labels-idx1-ubyte.gz', path+'train-images-idx3-ubyte.gz')

    for i in range(10):
        tensor = np.reshape(train_img[i], (28, 28, 1))
        im = summary.image('mnist/'+str(i), tensor)  # in this case, images are grouped under `mnist` tag.
        writer.add_summary(im, i+1)
    writer.flush()
    writer.close() 
开发者ID:dmlc,项目名称:tensorboard,代码行数:16,代码来源:test_image.py


注:本文中的tensorboard.FileWriter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。