(metrics)
| 15 | |
| 16 | |
| 17 | def 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 | |
| 28 | class AvgrageMeter(object): |
nothing calls this directly
no outgoing calls
no test coverage detected