code: def axpby_check_overflow_python(
      model_grad, stashed_grad, master_grad, a, b, check_overflow=False
  ):
      # Exception handling for 18.04 compatibility
      if check_overflow:
          cpu_sum = float(model_grad.float().sum())
          if (
              cpu_sum == float("inf")
              or cpu_sum == -float("inf")
              or cpu_sum != cpu_sum
          ):
              return True
  
      # if master_grad is not model_grad: # copy_ probably internally short-circuits this
      #     master_grad.copy_(model_grad)
      assert stashed_grad.dtype == master_grad.dtype
      converted_model_grad = model_grad.data.to(master_grad.dtype)
      master_grad.data = (
          a * converted_model_grad.data + b * stashed_grad.data
      )
      return False
  
file_path: apex/apex/amp/scaler.py
imports: import torch
  from ..multi_tensor_apply import multi_tensor_applier
  from ._amp_state import _amp_state, master_params, maybe_print
  from itertools import product
label_desc: Use image node_id 2 for calling a global function with example usage: axpby_check_overflow_python(model_grad, stashed_grad, master_grad, a, b, check_overflow) and returns: False, True