tensorbordX使用

时间:2022-08-06 15:25:38

安装:

pip install tensorflow-1.7.0
pip install tensorbord
pip install tensorbordX

启动

tensorboard --logdir runs
from tensorboardX import SummaryWriter

    writer = SummaryWriter('runs/cifar-10')
for n in range(args.epoch):
train_acc, train_loss = train(net, criterion, optimizer, trainloader, n)
writer.add_scalars('acc', {'train_acc':train_acc}, n)
writer.add_scalars('loss', {'train_loss':train_loss}, n) test_acc, test_loss = test(net, criterion, optimizer, testloader, n)
writer.add_scalars('loss', {'test_loss':test_loss}, n)
writer.add_scalars('acc',{'test_acc':test_acc}, n) print("train and test over")
writer.close()