Skip to content

Commit

Permalink
fix lint #580 (#590)
Browse files Browse the repository at this point in the history
  • Loading branch information
yhcao6 authored Sep 28, 2020
1 parent c80e4ca commit f6d5b0f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions mmcv/runner/hooks/optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,12 @@ def before_run(self, runner):
runner.optimizer.param_groups = copy.deepcopy(
runner.optimizer.param_groups)
state = defaultdict(dict)
p_map = {old_p: p for old_p, p in
zip(chain(*(g['params'] for g in old_groups)),
chain(*(g['params'] for g in runner.optimizer.param_groups)))}
p_map = {
old_p: p
for old_p, p in zip(
chain(*(g['params'] for g in old_groups)),
chain(*(g['params'] for g in runner.optimizer.param_groups)))
}
for k, v in runner.optimizer.state.items():
state[p_map[k]] = v
runner.optimizer.state = state
Expand Down

0 comments on commit f6d5b0f

Please sign in to comment.