mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-26 18:24:18 +00:00
Update utils.py
This commit is contained in:
parent
28fa30a255
commit
d04271219c
@ -472,16 +472,13 @@ class LossRecord(collections.defaultdict):
|
||||
all processes get the total.
|
||||
"""
|
||||
keys = sorted(self.keys())
|
||||
s = torch.tensor([ float(self[k]) for k in keys ],
|
||||
s = torch.tensor([float(self[k]) for k in keys],
|
||||
device=device)
|
||||
dist.all_reduce(s, op=dist.ReduceOp.SUM)
|
||||
for k, v in zip(keys, s.cpu().tolist()):
|
||||
self[k] = v
|
||||
|
||||
def write_summary(self,
|
||||
tb_writer: SummaryWriter,
|
||||
prefix: str,
|
||||
batch_idx: int) -> None:
|
||||
def write_summary(self, tb_writer: SummaryWriter, prefix: str, batch_idx: int) -> None:
|
||||
"""Add logging information to a TensorBoard writer.
|
||||
|
||||
Args:
|
||||
|
Loading…
x
Reference in New Issue
Block a user