code: def clip_tensors_by_global_norm(
      input_tensors, max_norm=1.0, global_norm=None, mpu=None, eps=1e-6
  ):
      """Clip list of tensors by global norm.
      Args:
          input_tensors: List of tensors to be clipped
          global_norm (float, optional): Precomputed norm. Defaults to None.
          mpu (optional): model parallelism unit. Defaults to None.
          eps (float, optional): epsilon value added to grad norm. Defaults to 1e-6
      Returns:
          float: the global norm
      """
      if global_norm is None:
          global_norm = get_global_norm_of_tensors(
              input_tensors, mpu=mpu
          )
  
      clip_coef = max_norm / (global_norm + eps)
  
      if clip_coef < 1:
          for t in input_tensors:
              t.detach().mul_(clip_coef)
  
      return global_norm
  
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 26 for calling a global function with example usage: clip_tensors_by_global_norm(input_tensors, max_norm, global_norm, mpu, eps) and returns: global_norm