code: def reduce_mean(tensor):
      """Reduce mean when distributed training."""
      if not (dist.is_available() and dist.is_initialized()):
          return tensor
      tensor = tensor.clone()
      dist.all_reduce(
          tensor.div_(dist.get_world_size()), op=dist.ReduceOp.SUM
      )
      return tensor
  
file_path: lavis/lavis/common/annotator/uniformer/mmseg/models/decode_heads/ema_head.py
imports: import math
  import torch
  import torch.distributed
  import torch.nn
  import torch.nn.functional
  from annotator.uniformer.mmcv.cnn import ConvModule
  from ..builder import HEADS
  from .decode_head import BaseDecodeHead
label_desc: Use image node_id 1 for calling a global function with example usage: reduce_mean(tensor) and returns: tensor, tensor