Skip to content

Commit

Permalink
Added doc strings to base logger file (#9232)
Browse files Browse the repository at this point in the history
* added doc strings to base logger

* updated docs
  • Loading branch information
justusschock authored and awaelchli committed Sep 7, 2021
1 parent dca4a41 commit 62ecd39
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pytorch_lightning/loggers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,9 @@ def update_agg_funcs(

@property
def experiment(self) -> List[Any]:
"""
Returns a list of experiment objects for all the loggers in the logger collection.
"""
return [logger.experiment for logger in self._logger_iterable]

def agg_and_log_metrics(self, metrics: Dict[str, float], step: Optional[int] = None):
Expand Down Expand Up @@ -412,16 +415,25 @@ def close(self) -> None:

@property
def save_dir(self) -> Optional[str]:
"""
Returns ``None`` as checkpoints should be saved to default / chosen location when using multiple loggers.
"""
# Checkpoints should be saved to default / chosen location when using multiple loggers
return None

@property
def name(self) -> str:
return "_".join([str(logger.name) for logger in self._logger_iterable])
"""
Returns the experiment names for all the loggers in the logger collection joined by an underscore.
"""
return "_".join(str(logger.name) for logger in self._logger_iterable)

@property
def version(self) -> str:
return "_".join([str(logger.version) for logger in self._logger_iterable])
"""
Returns the experiment versions for all the loggers in the logger collection joined by an underscore.
"""
return "_".join(str(logger.version) for logger in self._logger_iterable)


class DummyExperiment:
Expand Down Expand Up @@ -450,6 +462,7 @@ def __init__(self):

@property
def experiment(self) -> DummyExperiment:
"""Return the experiment object associated with this logger."""
return self._experiment

def log_metrics(self, *args, **kwargs) -> None:
Expand All @@ -460,10 +473,12 @@ def log_hyperparams(self, *args, **kwargs) -> None:

@property
def name(self) -> str:
"""Return the experiment name."""
return ""

@property
def version(self) -> str:
"""Return the experiment version."""
return ""

def __getitem__(self, idx) -> "DummyLogger":
Expand Down

0 comments on commit 62ecd39

Please sign in to comment.