code: def to_global(
      distributed_tensor: torch.Tensor, sharding_spec: ShardingSpec
  ) -> torch.Tensor:
      shape_consistency_manager = ShapeConsistencyManager()
      global_sharding_spec = ShardingSpec(
          sharding_spec.device_mesh, sharding_spec.entire_shape, {}
      )
      with torch.no_grad():
          global_tensor = (
              shape_consistency_manager.apply_for_autoparallel_runtime(
                  distributed_tensor,
                  sharding_spec,
                  global_sharding_spec,
              )
          )
      return global_tensor
  
imports: import math
  from copy import deepcopy
  from dataclasses import dataclass
  from typing import Dict, List, Tuple
  import numpy
  import torch
  from colossalai.auto_parallel.tensor_shard.sharding_strategy import MemoryCost, TrainCycleItem
  from colossalai.context.singleton_meta import SingletonMeta
  from colossalai.tensor.sharding_spec import ShardingSpec, ShardingSpecException
  from colossalai.tensor.utils import all_gather_simulator, all_to_all_simulator, mix_gather_simulator, shard_simulator
  from .comm_spec import *
label_desc: Use image node_id 1 for calling a global function with example usage: to_global(distributed_tensor, sharding_spec) and returns: global_tensor