- 載入函式
from torch.utils.tensorboard import SummaryWriter
- 新建資料夾
os.makedirs(f'{output_dir}/log', exist_ok=True)
- 初始化
writer = SummaryWriter('./log')
- 迴圈畫曲線
writer.add_scalar('loss', loss, iter)
- 開啟指令
tensorboard --logdir=./log --host=127.0.0.1
from torch.utils.tensorboard import SummaryWriter
os.makedirs(f'{output_dir}/log', exist_ok=True)
writer = SummaryWriter('./log')
writer.add_scalar('loss', loss, iter)
tensorboard --logdir=./log --host=127.0.0.1