Skip to content

Commit

Permalink
Add docstring to HyperparametersMixin (#9253)
Browse files Browse the repository at this point in the history
  • Loading branch information
popfido authored Sep 2, 2021
1 parent a451997 commit 165b823
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pytorch_lightning/core/mixins/hparams_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,26 @@ def _to_hparams_dict(hp: Union[MutableMapping, Namespace, str]):

@property
def hparams(self) -> Union[AttributeDict, dict, Namespace]:
"""
The collection of hyperparameters saved with :meth:`save_hyperparameters`. It is mutable by the user.
For the frozen set of initial hyperparameters, use :attr:`hparams_initial`.
Returns:
Union[AttributeDict, dict, Namespace]: mutable hyperparameters dicionary
"""
if not hasattr(self, "_hparams"):
self._hparams = AttributeDict()
return self._hparams

@property
def hparams_initial(self) -> AttributeDict:
"""
The collection of hyperparameters saved with :meth:`save_hyperparameters`. These contents are read-only.
Manual updates to the saved hyperparameters can instead be performed through :attr:`hparams`.
Returns:
AttributeDict: immutable initial hyperparameters
"""
if not hasattr(self, "_hparams_initial"):
return AttributeDict()
# prevent any change
Expand Down

0 comments on commit 165b823

Please sign in to comment.