code: def scale_loss(self, loss, optimizer):
      raise RuntimeError(
          "The old Amp API is no longer supported.  Please move to the new API, "
          "documented here:  https://nvidia.github.io/apex/amp.html.  Transition guide:  "
          "https://nvidia.github.io/apex/amp.html#transition-guide-for-old-api-users"
      )
  
      if not self.is_active():
          yield loss
          return
  
      if self._default_scaler is None:
          raise RuntimeError(
              "After calling `handle.wrap_optimizer()`, you must explicitly "
              + "use `optimizer.scale_loss(loss)`."
          )
  
      # TODO: this code block is duplicated here and `opt.py`. Unify.
      loss_scale = self._default_scaler.loss_scale()
      yield loss * loss_scale
  
      self._default_scaler.clear_overflow_state()
      self._default_scaler.unscale(
          master_params(optimizer), master_params(optimizer), loss_scale
      )
      should_skip = self._default_scaler.update_scale()
      if should_skip:
          optimizer_step = optimizer.step
  
          def skip_step():
              maybe_print("Gradient overflow, skipping update")
              optimizer.step = optimizer_step
  
          optimizer.step = skip_step
  
      self._clear_cache()
  
imports: import contextlib
  import warnings
  import sys
  import torch
  from .None import utils
  from .opt import OptimWrapper
  from .scaler import LossScaler
  from ._amp_state import _amp_state, master_params, maybe_print
label_desc: Use image node_id 5 for calling the AmpHandle obj's underlying member method code with example usage: obj.scale_loss(loss, optimizer) without return types