Skip to content

Commit 1542523

Browse files
authored
Update optimizer.py
1 parent f667db8 commit 1542523

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

torch/optim/optimizer.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -645,11 +645,11 @@ def register_load_state_dict_pre_hook(
645645
hook: Callable[["Optimizer", StateDict], Optional[StateDict]],
646646
prepend: bool = False,
647647
) -> RemovableHandle:
648-
r"""Register a state dict pre-hook which will be called before
649-
:meth:`~torch.optim.Optimizer.state_dict` is called. It should have the
648+
r"""Register a load_state_dict pre-hook which will be called before
649+
:meth:`~torch.optim.Optimizer.load_state_dict` is called. It should have the
650650
following signature::
651651
652-
hook(optimizer) -> None
652+
hook(optimizer, state_dict) -> state_dict or None
653653
654654
The ``optimizer`` argument is the optimizer instance being used and the
655655
``state_dict`` argument is a shallow copy of the ``state_dict`` the user
@@ -683,11 +683,11 @@ def register_load_state_dict_pre_hook(
683683
def register_load_state_dict_post_hook(
684684
self, hook: Callable[["Optimizer"], None], prepend: bool = False
685685
) -> RemovableHandle:
686-
r"""Register a state dict post-hook which will be called after
687-
:meth:`~torch.optim.Optimizer.state_dict` is called. It should have the
686+
r"""Register a load_state_dict post-hook which will be called after
687+
:meth:`~torch.optim.Optimizer.load_state_dict` is called. It should have the
688688
following signature::
689689
690-
hook(optimizer, state_dict) -> state_dict or None
690+
hook(optimizer) -> None
691691
692692
The ``optimizer`` argument is the optimizer instance being used.
693693

0 commit comments

Comments
 (0)