Update tensorboard.py

This commit is contained in:
Justus Schock 2020-04-27 09:44:26 +02:00 committed by GitHub
parent acfb054103
commit e309b55b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -101,7 +101,8 @@ class TensorBoardLogger(LightningLoggerBase):
return self._experiment
@rank_zero_only
def log_hyperparams(self, params: Union[Dict[str, Any], Namespace]) -> None:
def log_hyperparams(self, params: Union[Dict[str, Any], Namespace],
metrics: Optional[Dict[str, Any]] = None) -> None:
params = self._convert_params(params)
params = self._flatten_dict(params)
sanitized_params = self._sanitize_params(params)
@ -114,7 +115,9 @@ class TensorBoardLogger(LightningLoggerBase):
)
else:
from torch.utils.tensorboard.summary import hparams
exp, ssi, sei = hparams(sanitized_params, {})
if metrics is None:
metrics = {}
exp, ssi, sei = hparams(sanitized_params, metrics)
writer = self.experiment._get_file_writer()
writer.add_summary(exp)
writer.add_summary(ssi)