Create single file in TensorBoardLogger (#777)

* write to single file

* fix import
This commit is contained in:
Dmitry Lipin 2020-02-02 17:31:45 +03:00 committed by GitHub
parent 472f394788
commit b5cab7e0f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -84,8 +84,12 @@ class TensorBoardLogger(LightningLoggerBase):
" hyperparameter logging."
)
else:
# `add_hparams` requires both - hparams and metric
self.experiment.add_hparams(hparam_dict=params, metric_dict={})
from torch.utils.tensorboard.summary import hparams
exp, ssi, sei = hparams(params, {})
writer = self.experiment._get_file_writer()
writer.add_summary(exp)
writer.add_summary(ssi)
writer.add_summary(sei)
# some alternative should be added
self.tags.update(params)