Skip to content

Commit

Permalink
optimize comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyi-Lin committed Jan 20, 2025
1 parent 2a0b105 commit 9c81230
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions swanlab/sync/tensorboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,15 @@ def sync_tensorboardX():
from tensorboardX import SummaryWriter
import numpy as np
# 创建一个SummaryWriter对象,指定日志目录
import swanlab
swanlab.sync_tensorboardX()
writer = SummaryWriter('runs/example')
# 生成一些示例数据
for i in range(100):
# 生成一个随机的标量值
scalar_value = np.random.rand()
# 记录标量值
writer.add_scalar('random_scalar', scalar_value, i)
# 关闭SummaryWriter
writer.close()
"""
try:
Expand Down Expand Up @@ -68,19 +64,15 @@ def sync_tensorboard_torch():
from torch.utils.tensorboard import SummaryWriter
import numpy as np
# 创建一个SummaryWriter对象,指定日志目录
import swanlab
swanlab.sync_tensorboard_torch()
writer = SummaryWriter('runs/example')
# 生成一些示例数据
for i in range(100):
# 生成一个随机的标量值
scalar_value = np.random.rand()
# 记录标量值
writer.add_scalar('random_scalar', scalar_value, i)
# 关闭SummaryWriter
writer.close()
"""
try:
Expand Down

0 comments on commit 9c81230

Please sign in to comment.