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["loss_scaler"] = self.loss_scaler
      state_dict["dynamic_loss_scale"] = self.dynamic_loss_scale
      state_dict["overflow"] = self.overflow
      state_dict[
          "first_closure_call_this_step"
      ] = self.first_closure_call_this_step
      state_dict["optimizer_state_dict"] = self.optimizer.state_dict()
      state_dict["fp32_from_fp16"] = self.fp32_from_fp16_groups
      return state_dict
  
imports: import torch
  from torch import nn
  from torch.autograd import Variable
  from torch.nn.parameter import Parameter
  from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
  from ..amp._amp_state import _amp_state, maybe_print
  from ..amp.scaler import LossScaler
  from ..multi_tensor_apply import multi_tensor_applier
  from .fp16util import model_grads_to_master_grads, master_params_to_model_params, clip_grad_norm
label_desc: Use image node_id 8 for calling the FP16_Optimizer obj's underlying member method code with example usage: obj.state_dict() and returns: state_dict