code: def all_reduce_mean(tensor: torch.Tensor) -> torch.Tensor:
      dist.all_reduce(tensor=tensor, op=dist.ReduceOp.SUM)
      tensor.div_(dist.get_world_size())
      return tensor
  
imports: import argparse
  import json
  import os
  import resource
  from contextlib import nullcontext
  import torch
  import torch.distributed
  from colossal_llama2.dataset.loader import DataCollatorForSupervisedDataset, StatefulDistributedSampler, load_tokenized_dataset, setup_distributed_dataloader
  from colossal_llama2.utils.ckpt_io import load_checkpoint, save_checkpoint
  from colossal_llama2.utils.flash_attention_patch import replace_with_flash_attention
  from colossal_llama2.utils.froze import freeze_non_embeds_parameters
  from colossal_llama2.utils.neftune_patch import activate_neftune, deactivate_neftune
  from torch.utils.tensorboard import SummaryWriter
  from tqdm import tqdm
  from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer
  import colossalai
  from colossalai.booster import Booster
  from colossalai.booster.plugin import GeminiPlugin, HybridParallelPlugin, LowLevelZeroPlugin
  from colossalai.cluster import DistCoordinator
  from colossalai.lazy import LazyInitContext
  from colossalai.nn.lr_scheduler import CosineAnnealingWarmupLR
  from colossalai.nn.optimizer import HybridAdam
  from colossalai.utils import get_current_device
label_desc: Use image node_id 3 for calling a global function with example usage: all_reduce_mean(tensor) and returns: tensor