Training the model in pycharm, using the terminal tensorboard --logdir=result
to , always reporting an error, and starting to search for information, including grammar, tensorboard version problems, can not be solved, and finally found a stupid problem, the logdir path in tensorboard is a relative path, in pycharm The terminal is the project path, and my code is in the first-level directory under the project. Of course, the generated log file cannot be found. CD to the upper-level directory of the running code to solve the problem.
Additional:
How to use tensorboard in pytorch
# 创建一个写方法
writer = SummaryWriter(log_dir='result',flush_secs=120)
# 添加到 训练的循环中,scalar_value为显示的数值
writer.add_scalar(tag='loss',scalar_value=train_loss,global_step=epoch)
# 在新的代码路径下的terminal中开启tensorboard服务
tensorboard --logdir=result