class_docstr: A shard aware Grad Scaler which enables loss scaling with/without cpu_offload. This is a
  slight modification of the pytorch grad scaler.
  https://pytorch.org/docs/stable/amp.html#torch.cuda.amp.GradScaler
class_docstr_tok: ["A","shard","aware","Grad","Scaler","which","enables","loss","scaling","with\/without","cpu_offload",".","This","is","a","slight","modification","of","the","pytorch","grad","scaler",".","https",":","\/\/pytorch.org\/docs\/stable\/amp.html","#","torch.cuda.amp.GradScaler"]
docstr: If found_inf is 1.0 (True), then scale is multiplied by backoff_factor and growth_tracker is set to zero.
  Otherwise, scale is multiplied by the growth factor when the growth interval is reached.
docstr_tok: ["If","found_inf","is","1.0","(","True",")",",","then","scale","is","multiplied","by","backoff_factor","and","growth_tracker","is","set","to","zero",".","Otherwise",",","scale","is","multiplied","by","the","growth","factor","when","the","growth","interval","is","reached","."]
code: def _amp_update_scale_cpu_(self, found_inf):  # type: ignore
      """
      If found_inf is 1.0 (True), then scale is multiplied by backoff_factor and growth_tracker is set to zero.
      Otherwise, scale is multiplied by the growth factor when the growth interval is reached.
      """
      if found_inf.item() == 1.0:
          self._scale *= self._backoff_factor  # type: ignore
          self._growth_tracker = 0
      else:
          successful = self._growth_tracker + 1
          if successful == self._growth_interval:  # type: ignore
              self._scale *= self._growth_factor  # type: ignore
              self._growth_tracker = 0
          else:
              self._growth_tracker = successful
  
imports: from collections import defaultdict
  import collections.abc
  from enum import Enum
  import logging
  from typing import Any, Dict, List, Optional, Union
  import warnings
  import torch
  from torch.cuda import FloatTensor
  from torch.cuda.amp.common import amp_definitely_not_available
  from torch.cuda.amp.grad_scaler import GradScaler
  import torch.distributed
  from torch.optim import Optimizer
  from torch.optim.sgd import SGD
  from fairscale.internal import torch_version
label_desc: Use image node_id 7 for calling the ShardedGradScaler obj's underlying member method code with example usage: obj._amp_update_scale_cpu_(found_inf) without return types