class_docstr: Gradient scaler for the PyTorch shim.
  
  Gradients with small magnitudes are not representable in half-precision and
  will underflow to zero. A gradient scaler counters this issue by scaling
  up the loss before backpropagation, increasing the gradients by the same
  magnitude. A large enough scale will avoid that the gradients underflow.
  The gradients are unscaled in single precision after backpropagation, to
  provide the unscaled gradients to the optimizer.
docstr: Update the scale factor and clear information about infinities.
  
  This method should be called after each optimization step.
code: def update(self):
      """
      Update the scale factor and clear information about infinities.
  
      This method should be called after each optimization step.
      """
      if not self._enabled:
          return
  
      found_inf_device = torch.full(
          (1,),
          1.0 if self._found_inf else 0.0,
          device=self._scale.device,
      )
      torch._amp_update_scale_(
          self._scale,
          self._growth_tracker,
          found_inf_device,
          self._growth_factor,
          self._backoff_factor,
          self._growth_interval,
      )
  
      # Clear infinity found status
      self._found_inf = False
  
file_path: thinc/thinc/shims/pytorch_grad_scaler.py
imports: from typing import Dict, Iterable, List, Union, cast
  from ..compat import has_torch_amp, torch
  from ..util import is_torch_array
label_desc: Use image node_id 8 for calling the PyTorchGradScaler obj's underlying member method code with example usage: obj.update() without return types