code: def _handle_overflow(cpu_sum, x, i):
      import math
  
      rank = dist.get_rank()
      if rank == 0:
          t_i = -1
          for v_i, v in enumerate(x.data.contiguous().view(-1)):
              if not math.isfinite(float(v)):
                  t_i = v_i
                  break
          logger.info(
              f"rank {rank} detected overflow {cpu_sum} in tensor {i}:{t_i} shape {x.shape}"
          )
  
imports: from collections.abc import Iterable
  from deepspeed.moe.utils import is_moe_param
  import os
  import psutil
  import gc
  from math import sqrt
  from math import floor
  from bisect import bisect_left
  import torch
  from torch import inf
  from deepspeed import comm
  from deepspeed.utils import groups, logger
  from deepspeed.runtime.constants import PIPE_REPLICATED
  from numpy import prod
label_desc: Use image node_id 8 for calling a global function with example usage: _handle_overflow(cpu_sum, x, i) without return types