Skip to content

Commit ff06ef0

Browse files
author
anonymous
authored
Checking for requires_grad
1 parent 1319ca6 commit ff06ef0

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

torch_optimizer/lookahead.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def __init__(
5757

5858
def _update(self, group: Dict[str, Any]) -> None:
5959
for fast in group["params"]:
60+
if not fast.requires_grad:
61+
continue
62+
6063
param_state = self.state[fast]
6164
if "slow_param" not in param_state:
6265
param_state["slow_param"] = torch.clone(fast.data).detach()

0 commit comments

Comments
 (0)