code: def get_tensor_shape():
      if hasattr(gpc.config, "TENSOR_SHAPE"):
          return gpc.config.TENSOR_SHAPE
  
      if not gpc.is_initialized(ParallelMode.PIPELINE):
          return None
  
      if (
          hasattr(gpc.config, "SEQ_LENGTH")
          and hasattr(gpc.config, "GLOBAL_BATCH_SIZE")
          and hasattr(gpc.config, "GLOBAL_BATCH_SIZE")
          and hasattr(gpc.config, "HIDDEN_SIZE")
      ):
          if gpc.is_initialized(ParallelMode.DATA):
              dp_size = gpc.get_world_size(ParallelMode.DATA)
          else:
              dp_size = 1
          if gpc.is_initialized(ParallelMode.SEQUENCE):
              seq_size = gpc.get_world_size(ParallelMode.SEQUENCE)
          else:
              seq_size = 1
  
          tensor_shape = (
              gpc.config.SEQ_LENGTH // seq_size,
              gpc.config.GLOBAL_BATCH_SIZE
              // dp_size
              // gpc.config.NUM_MICRO_BATCHES,
              gpc.config.HIDDEN_SIZE,
          )
          return tensor_shape
      else:
          return None
  
imports: import inspect
  from typing import Callable, List, Tuple, Union
  import torch.cuda
  import colossalai.legacy.communication
  from colossalai.legacy.amp.naive_amp import NaiveAMPModel
  from colossalai.legacy.context.parallel_mode import ParallelMode
  from colossalai.legacy.core import global_context
  from colossalai.legacy.utils import switch_virtual_pipeline_parallel_rank
  from colossalai.logging import get_dist_logger
  from colossalai.utils.device import get_current_device
  from ._base_schedule import BaseSchedule
label_desc: Use image node_id 1 for calling a global function with example usage: get_tensor_shape() and returns: gpc, None, tensor_shape, None