code: def reduce_tensor(tensor):
      world_size = get_world_size()
  
      if world_size < 2:
          return tensor
  
      with torch.no_grad():
          dist.reduce(tensor, dst=0)
          if dist.get_rank() == 0:
              tensor = tensor.div(world_size)
  
      return tensor
  
imports: import contextlib
  import logging
  import os
  import pickle
  import socket
  import subprocess
  import warnings
  from itertools import chain
  import torch
  from mmf.common.registry import registry
  from torch import distributed
label_desc: Use image node_id 10 for calling a global function with example usage: reduce_tensor(tensor) and returns: tensor, tensor