MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / tensors_to_scalars

Function tensors_to_scalars

utils/__init__.py:17–25  ·  view source on GitHub ↗
(metrics)

Source from the content-addressed store, hash-verified

15
16
17def tensors_to_scalars(metrics):
18 new_metrics = {}
19 for k, v in metrics.items():
20 if isinstance(v, torch.Tensor):
21 v = v.item()
22 if type(v) is dict:
23 v = tensors_to_scalars(v)
24 new_metrics[k] = v
25 return new_metrics
26
27
28class AvgrageMeter(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected