class_docstr: Like :class:`SimpleTrainer`, but uses PyTorch's native automatic mixed precision
  in the training loop.
class_docstr_tok: ["Like",":","class",":","`","SimpleTrainer","`",",","but","uses","PyTorch","'s","native","automatic","mixed","precision","in","the","training","loop","."]
code: def state_dict(self):
      ret = super().state_dict()
      ret["grad_scaler"] = self.grad_scaler.state_dict()
      return ret
  
imports: import concurrent.futures
  import logging
  import numpy
  import time
  import weakref
  from typing import List, Mapping, Optional
  import torch
  from torch.nn.parallel import DataParallel, DistributedDataParallel
  import detectron2.utils.comm
  from detectron2.utils.events import EventStorage, get_event_storage
  from detectron2.utils.logger import _log_api_usage
label_desc: Use image node_id 3 for calling the AMPTrainer obj's underlying member method code with example usage: obj.state_dict() and returns: ret