未验证 提交 fec014e9 编写于 作者: L Lin Manhui 提交者: GitHub

Suppress scalar warnings (#10509)

上级 bb616dbf
...@@ -346,7 +346,10 @@ def train(config, ...@@ -346,7 +346,10 @@ def train(config,
lr_scheduler.step() lr_scheduler.step()
# logger and visualdl # logger and visualdl
stats = {k: v.numpy().mean() for k, v in loss.items()} stats = {
k: float(v) if v.shape == [] else v.numpy().mean()
for k, v in loss.items()
}
stats['lr'] = lr stats['lr'] = lr
train_stats.update(stats) train_stats.update(stats)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册