(self, metrics)
| 943 | self.tqdm_metrics[k] = v |
| 944 | |
| 945 | def metrics_to_scalars(self, metrics): |
| 946 | new_metrics = {} |
| 947 | for k, v in metrics.items(): |
| 948 | if isinstance(v, torch.Tensor): |
| 949 | v = v.item() |
| 950 | |
| 951 | if type(v) is dict: |
| 952 | v = self.metrics_to_scalars(v) |
| 953 | |
| 954 | new_metrics[k] = v |
| 955 | |
| 956 | return new_metrics |
| 957 | |
| 958 | def process_output(self, output, train=False): |
| 959 | """Reduces output according to the training mode. |