code: def reduce_tensor(inp_tensor: torch.Tensor) -> torch.Tensor:
      size = dist.get_world_size() if dist.is_initialized() else 1
      inp_tensor_clone = inp_tensor.clone().detach()
      # dist_barrier()
      dist.all_reduce(inp_tensor_clone, op=dist.ReduceOp.SUM)
      inp_tensor_clone /= size
      return inp_tensor_clone
  
file_path: ml-cvnets/utils/tensor_utils.py
imports: from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  from torch import distributed
  from common import DEFAULT_IMAGE_CHANNELS, DEFAULT_IMAGE_HEIGHT, DEFAULT_IMAGE_WIDTH, DEFAULT_VIDEO_FRAMES
  from utils.third_party.ddp_functional_utils import all_gather
label_desc: Use image node_id 4 for calling a global function with example usage: reduce_tensor(inp_tensor) and returns: inp_tensor_clone