From 5f292390fdc7e0dc70e93ea08d75f5e738a00775 Mon Sep 17 00:00:00 2001 From: Justus Schock <12886177+justusschock@users.noreply.github.com> Date: Tue, 12 May 2020 13:25:12 +0200 Subject: [PATCH] Bug fix hparam logging with metrics (#1647) * add metric logging * Use pytorch built-in method * Update tensorboard.py * Update tensorboard.py --- pytorch_lightning/loggers/tensorboard.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pytorch_lightning/loggers/tensorboard.py b/pytorch_lightning/loggers/tensorboard.py index fc33c9e942..90e24624a3 100644 --- a/pytorch_lightning/loggers/tensorboard.py +++ b/pytorch_lightning/loggers/tensorboard.py @@ -115,6 +115,7 @@ class TensorBoardLogger(LightningLoggerBase): ) else: from torch.utils.tensorboard.summary import hparams + if metrics is None: metrics = {} exp, ssi, sei = hparams(sanitized_params, metrics) @@ -123,6 +124,10 @@ class TensorBoardLogger(LightningLoggerBase): writer.add_summary(ssi) writer.add_summary(sei) + if metrics: + # necessary for hparam comparison with metrics + self.log_metrics(metrics) + # some alternative should be added self.tags.update(sanitized_params)