class_docstr: FP16 Optimizer for training fp16 models. Handles loss scaling.
  
  For usage example please see, TODO:  DeepSpeed V2 Tutorial
   
class_docstr_tok: ["FP16","Optimizer","for","training","fp16","models",".","Handles","loss","scaling",".","For","usage","example","please","see",",","TODO",":","DeepSpeed","V2","Tutorial"]
docstr: Returns a dict containing the current state of this :class:`FP16_Optimizer` instance.
  This dict contains attributes of :class:`FP16_Optimizer`, as well as the state_dict
  of the contained Pytorch optimizer.
  Example::
      checkpoint = {}
      checkpoint['model'] = model.state_dict()
      checkpoint['optimizer'] = optimizer.state_dict()
      torch.save(checkpoint, "saved.pth")
docstr_tok: ["Returns","a","dict","containing","the","current","state","of","this",":","class",":","`","FP16_Optimizer","`","instance",".","This","dict","contains","attributes","of",":","class",":","`","FP16_Optimizer","`",",","as","well","as","the","state_dict","of","the","contained","Pytorch","optimizer",".","Example",":",":","checkpoint","=","{","}","checkpoint","[","'model","'","]","=","model.state_dict","(",")","checkpoint","[","'optimizer","'","]","=","optimizer.state_dict","(",")","torch.save","(","checkpoint",",","``","saved.pth","''",")"]
code: def state_dict(self):
      """
      Returns a dict containing the current state of this :class:`FP16_Optimizer` instance.
      This dict contains attributes of :class:`FP16_Optimizer`, as well as the state_dict
      of the contained Pytorch optimizer.
      Example::
          checkpoint = {}
          checkpoint['model'] = model.state_dict()
          checkpoint['optimizer'] = optimizer.state_dict()
          torch.save(checkpoint, "saved.pth")
      """
      state_dict = {}
      state_dict["dynamic_loss_scale"] = self.dynamic_loss_scale
      state_dict["cur_scale"] = self.cur_scale
      state_dict["cur_iter"] = self.cur_iter
      if state_dict["dynamic_loss_scale"]:
          state_dict["last_overflow_iter"] = self.last_overflow_iter
          state_dict["scale_factor"] = self.scale_factor
          state_dict["scale_window"] = self.scale_window
      state_dict[OPTIMIZER_STATE_DICT] = self.optimizer.state_dict()
      state_dict["fp32_groups_flat"] = self.fp32_groups_flat
      state_dict[CLIP_GRAD] = self.clip_grad
      return state_dict
  
imports: import torch
  from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
  from deepspeed.runtime import DeepSpeedOptimizer
  from deepspeed.runtime.utils import get_global_norm, get_grad_norm, CheckOverflow, get_weight_norm, required_torch_version
  from deepspeed.runtime.fp16.loss_scaler import INITIAL_LOSS_SCALE, SCALE_WINDOW, MIN_LOSS_SCALE
  from deepspeed.utils import groups, logger, log_dist
  from deepspeed import comm
  from deepspeed.checkpoint.constants import OPTIMIZER_STATE_DICT, CLIP_GRAD
  from deepspeed.accelerator import get_accelerator
label_desc: Use image node_id 17 for calling the FP16_Optimizer obj's underlying member method code with example usage: obj.state_dict() and returns: state_dict