From d2f9986f2c8a821fd6da7e17dd2dd2d7d3544c5d Mon Sep 17 00:00:00 2001 From: ryanwongsa Date: Mon, 11 Nov 2019 18:24:24 +0000 Subject: [PATCH] fixed issue where callback_metrics was replaced instead of updated --- pytorch_lightning/trainer/evaluation_loop_mixin.py | 2 +- pytorch_lightning/trainer/train_loop_mixin.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch_lightning/trainer/evaluation_loop_mixin.py b/pytorch_lightning/trainer/evaluation_loop_mixin.py index c2ba5d16fa97a..8583805ab772d 100644 --- a/pytorch_lightning/trainer/evaluation_loop_mixin.py +++ b/pytorch_lightning/trainer/evaluation_loop_mixin.py @@ -138,7 +138,7 @@ def run_evaluation(self, test=False): self.log_metrics(log_metrics, {}) # track metrics for callbacks - self.callback_metrics = callback_metrics + self.callback_metrics.update(callback_metrics) # hook model.on_post_performance_check() diff --git a/pytorch_lightning/trainer/train_loop_mixin.py b/pytorch_lightning/trainer/train_loop_mixin.py index 306416db8d7ed..68c34cf4f3793 100644 --- a/pytorch_lightning/trainer/train_loop_mixin.py +++ b/pytorch_lightning/trainer/train_loop_mixin.py @@ -258,7 +258,7 @@ def optimizer_closure(): all_log_metrics = {k: v for d in all_log_metrics for k, v in d.items()} # track all metrics for callbacks - self.callback_metrics = {k: v for d in all_callback_metrics for k, v in d.items()} + self.callback_metrics.update({k: v for d in all_callback_metrics for k, v in d.items()}) return 0, grad_norm_dic, all_log_metrics