class_docstr: FP16_Optimizer is designed to wrap an existing PyTorch optimizer,
  and enable an fp16 model to be trained using a main copy of fp32 weights.
  
  Args:
      optimizer (torch.optim.optimizer):  Existing optimizer containing initialized fp16 parameters.  Internally, FP16_Optimizer replaces the passed optimizer's fp16 parameters with new fp32 parameters copied from the original ones.  FP16_Optimizer also stores references to the original fp16 parameters, and updates these fp16 parameters from the main fp32 copy after each step.
      static_loss_scale (float, optional, default=1.0):  Loss scale used internally to scale fp16 gradients computed by the model.  Scaled gradients will be copied to fp32, then downscaled before being applied to the fp32 main params, so static_loss_scale should not affect learning rate.
      dynamic_loss_scale (bool, optional, default=False):  Use dynamic loss scaling.  If True, this will override any static_loss_scale option.
class_docstr_tok: ["FP16_Optimizer","is","designed","to","wrap","an","existing","PyTorch","optimizer",",","and","enable","an","fp16","model","to","be","trained","using","a","main","copy","of","fp32","weights",".","Args",":","optimizer","(","torch.optim.optimizer",")",":","Existing","optimizer","containing","initialized","fp16","parameters",".","Internally",",","FP16_Optimizer","replaces","the","passed","optimizer","'s","fp16","parameters","with","new","fp32","parameters","copied","from","the","original","ones",".","FP16_Optimizer","also","stores","references","to","the","original","fp16","parameters",",","and","updates","these","fp16","parameters","from","the","main","fp32","copy","after","each","step",".","static_loss_scale","(","float",",","optional",",","default=1.0",")",":","Loss","scale","used","internally","to","scale","fp16","gradients","computed","by","the","model",".","Scaled","gradients","will","be","copied","to","fp32",",","then","downscaled","before","being","applied","to","the","fp32","main","params",",","so","static_loss_scale","should","not","affect","learning","rate",".","dynamic_loss_scale","(","bool",",","optional",",","default=False",")",":","Use","dynamic","loss","scaling",".","If","True",",","this","will","override","any","static_loss_scale","option","."]
docstr: Loads a state_dict created by an earlier call to state_dict.
  
  Untested.
docstr_tok: ["Loads","a","state_dict","created","by","an","earlier","call","to","state_dict",".","Untested","."]
code: def load_state_dict(self, state_dict):
      """
      Loads a state_dict created by an earlier call to state_dict.
  
      Untested.
      """
      self.loss_scaler = state_dict["loss_scaler"]
      self.dynamic_loss_scale = state_dict["dynamic_loss_scale"]
      self.overflow = state_dict["overflow"]
      self.first_closure_call_this_step = state_dict[
          "first_closure_call_this_step"
      ]
      self.optimizer.load_state_dict(state_dict["optimizer_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 common.loss_scaler import DynamicLossScaler, LossScaler
label_desc: Use image node_id 10 for calling the FP16_Optimizer obj's underlying member method code with example usage: obj.load_state_dict(state_dict) without return types