代码拉取完成,页面将自动刷新
# The following switch allows the program runs locally and in the Agit environment without modifications.
import os
path = os.path.dirname(__file__)
print(path)
if 'CLOUD_PROVIDER' in os.environ and os.environ['CLOUD_PROVIDER'] == 'Agit':
logdir = '/root/.agit'
else:
logdir = './runs'
# setup tensorboard path
import tensorflow as tf
writer = tf.summary.create_file_writer(logdir)
''' alternative tensorboards
# pytorch tensorboard :
from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter(log_dir=logdir)
# tensorboardX :
from tensorboardX import SummaryWriter
writer = SummaryWriter(logdir=logdir)
'''
import numpy as np
import time
# a 5 minutes running example, the realtime tensorboard can be viewed in the training page
with writer.as_default():
for n_iter in range(360):
tf.summary.scalar('Loss/train', np.random.random(), n_iter)
tf.summary.scalar('Loss/test', np.random.random(), n_iter)
tf.summary.scalar('Accuracy/train', np.random.random(), n_iter)
tf.summary.scalar('Accuracy/test', np.random.random(), n_iter)
time.sleep(1)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。