Skip to content

Commit

Permalink
Suppress scalar teensor warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobholamovic committed Aug 17, 2023
1 parent 42ac0a9 commit 600caff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion paddlers/utils/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ def update(self, stats):
for k in stats.keys()
}
for k, v in self.meters.items():
v.update(stats[k].numpy())
stat = stats[k]
if stat.ndim == 0:
stat = float(stat)
else:
stat = stat.numpy()
v.update(stat)

def get(self, extras=None):
stats = collections.OrderedDict()
Expand Down

0 comments on commit 600caff

Please sign in to comment.