Bug fix hparam logging with metrics (#1647)

* add metric logging

* Use pytorch built-in method

* Update tensorboard.py

* Update tensorboard.py
This commit is contained in:
Justus Schock 2020-05-12 13:25:12 +02:00 committed by GitHub
parent 35ac30e688
commit 5f292390fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -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)