Skip to content

Commit 165b823

Browse files
authored
Add docstring to HyperparametersMixin (#9253)
1 parent a451997 commit 165b823

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pytorch_lightning/core/mixins/hparams_mixin.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,26 @@ def _to_hparams_dict(hp: Union[MutableMapping, Namespace, str]):
126126

127127
@property
128128
def hparams(self) -> Union[AttributeDict, dict, Namespace]:
129+
"""
130+
The collection of hyperparameters saved with :meth:`save_hyperparameters`. It is mutable by the user.
131+
For the frozen set of initial hyperparameters, use :attr:`hparams_initial`.
132+
133+
Returns:
134+
Union[AttributeDict, dict, Namespace]: mutable hyperparameters dicionary
135+
"""
129136
if not hasattr(self, "_hparams"):
130137
self._hparams = AttributeDict()
131138
return self._hparams
132139

133140
@property
134141
def hparams_initial(self) -> AttributeDict:
142+
"""
143+
The collection of hyperparameters saved with :meth:`save_hyperparameters`. These contents are read-only.
144+
Manual updates to the saved hyperparameters can instead be performed through :attr:`hparams`.
145+
146+
Returns:
147+
AttributeDict: immutable initial hyperparameters
148+
"""
135149
if not hasattr(self, "_hparams_initial"):
136150
return AttributeDict()
137151
# prevent any change

0 commit comments

Comments
 (0)