##### tensorboard ########
from tensorboardX import SummaryWriter
writer = SummaryWriter(args.tensorboard) #--tensorboard', default="./checkpoint/tensorboard"
...
for epoch in range(args.end_epoch):
...
#scheduler = torch.optim.lr_scheduler.ReduceLROnPlateau(optimizer, mode='min', patience=args.lr_patience, verbose=True)
writer.add_scalar('data/weighted_loss', weighted_train_loss, epoch)
writer.add_scalars('data/loss', {'val loss': val_loss, 'train loss': train_loss}, epoch)
writer.close()