mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Fix the type hint of step()
with default value (#153367)
Summary: Because the default value of `closure` is `None`, this fixes the situation when `step()`. The previous typing (https://github.com/pytorch/pytorch/pull/102593) could only be used as `step(closure=None)` and `step(None)`. Test Plan: contbuild & OSS CI Differential Revision: D74560785 Pull Request resolved: https://github.com/pytorch/pytorch/pull/153367 Approved by: https://github.com/cyyever, https://github.com/Skylion007, https://github.com/janeyx99
This commit is contained in:
committed by
PyTorch MergeBot
parent
de5c5f4fb7
commit
ea4b65ab60
@ -1004,7 +1004,7 @@ class Optimizer:
|
||||
torch._foreach_zero_(grads)
|
||||
|
||||
@overload
|
||||
def step(self, closure: None = ...) -> None:
|
||||
def step(self, closure: None = None) -> None:
|
||||
...
|
||||
|
||||
@overload
|
||||
|
Reference in New Issue
Block a user