code: def broadcast(tensor: torch.Tensor, src: int = 0) -> torch.Tensor:
      """
      Wrapper over torch.distributed.broadcast for broadcasting a tensor from the source
      to all processes in both distributed / non-distributed scenarios.
      """
      if is_distributed_training_run():
          tensor, orig_device = convert_to_distributed_tensor(tensor)
          torch.distributed.broadcast(tensor, src)
          tensor = convert_to_normal_tensor(tensor, orig_device)
      return tensor
  
imports: import io
  import tempfile
  from typing import Any, Callable, List, Tuple
  import torch
label_desc: Use image node_id 12 for calling a global function with example usage: broadcast(tensor, src) and returns: tensor