code: def reduce_sum(tensor):
      world_size = get_world_size()
      if world_size < 2:
          return tensor
      tensor = tensor.clone()
      dist.all_reduce(tensor, op=dist.ReduceOp.SUM)
      return tensor
  
imports: import functools
  import logging
  import pickle
  import numpy
  import torch
  import torch.distributed
label_desc: Use image node_id 2 for calling a global function with example usage: reduce_sum(tensor) and returns: tensor, tensor