class_docstr: Implements Lookahead optimization algorithm.
  
  It has been proposed in `Lookahead Optimizer: k steps forward, 1
  step back`__
  
  Arguments:
      optimizer: base inner optimizer optimize, like Yogi, DiffGrad or Adam.
      k: number of lookahead steps (default: 5)
      alpha: linear interpolation factor. 1.0 recovers the inner optimizer.
          (default: 5)
  
  Example:
      >>> import torch_optimizer as optim
      >>> yogi = optim.Yogi(model.parameters(), lr=0.1)
      >>> optimizer = optim.Lookahead(yogi, k=5, alpha=0.5)
      >>> optimizer.zero_grad()
      >>> loss_fn(model(input), target).backward()
      >>> optimizer.step()
  
  __ https://arxiv.org/abs/1907.08610
  
  Note:
      Reference code: https://github.com/alphadl/lookahead.pytorch
docstr: Loads the optimizer state.
  
  Arguments:
      state_dict: optimizer state. Should be an object returned
          from a call to :meth:`state_dict`.
docstr_tok: ["Loads","the","optimizer","state",".","Arguments",":","state_dict",":","optimizer","state",".","Should","be","an","object","returned","from","a","call","to",":","meth",":","`","state_dict","`","."]
code: def load_state_dict(self, state_dict: State) -> None:
      r"""Loads the optimizer state.
  
      Arguments:
          state_dict: optimizer state. Should be an object returned
              from a call to :meth:`state_dict`.
      """
      slow_state_dict = {
          "state": state_dict["slow_state"],
          "param_groups": state_dict["param_groups"],
      }
      fast_state_dict = {
          "state": state_dict["fast_state"],
          "param_groups": state_dict["param_groups"],
      }
      super(Lookahead, self).load_state_dict(slow_state_dict)
      self.optimizer.load_state_dict(fast_state_dict)
      self.fast_state = self.optimizer.state
  
file_path: pytorch-optimizer/torch_optimizer/lookahead.py
imports: from collections import defaultdict
  from typing import Any, Dict
  import torch
  from torch.optim.optimizer import Optimizer
  from .types import OptFloat, OptLossClosure, State
label_desc: Use image node_id 5 for calling the Lookahead obj's underlying member method code with example usage: obj.load_state_dict(state_dict) without return types