code: def _runtime_comm_spec_apply_meta_info(
      node: Node, comm_actions_dict: Dict
  ) -> ShardMetaInfo:
      # extract node_index and op_data_name
      node_index, op_data_name = node.args[2], node.args[3]
  
      comm_action = comm_actions_dict[node_index][op_data_name]
      if isinstance(comm_action.comm_spec, CommSpec):
          # this case is for all_reduce, there will be no memory cost
          meta_info = ShardMetaInfo()
          meta_info.memory_cost = TrainCycleItem(
              MemoryCost(), MemoryCost(), MemoryCost
          )
          output_node = next(
              n for n in node.users if hasattr(n, "_meta_data")
          )
          element_length = output_node._meta_data.element_size()
  
          total_cost = comm_action.comm_spec.get_comm_cost()
          meta_info.compute_cost = TrainCycleItem(
              total_cost["forward"] * element_length,
              total_cost["backward"] * element_length,
              total_cost["total"] * element_length,
          )
  
          input_shape = (
              output_shape
          ) = (
              comm_action.comm_spec.sharding_spec.get_sharded_shape_per_device()
          )
          meta_info.fwd_in = [torch.rand(input_shape, device="meta")]
          meta_info.fwd_buffer = []
          meta_info.fwd_out = [torch.rand(output_shape, device="meta")]
      else:
          # this case will be handled by shape consistency manager
          origin_sharding_spec, target_sharding_spec = (
              comm_action.comm_spec["src_spec"],
              comm_action.comm_spec["tgt_spec"],
          )
          meta_info = _construct_shard_meta_info(
              node, origin_sharding_spec, target_sharding_spec
          )
  
      return meta_info
  
file_path: ColossalAI/colossalai/auto_parallel/passes/comm_metainfo_pass.py
imports: from typing import Dict
  import torch
  from torch.fx import GraphModule
  from torch.fx.node import Node
  from colossalai.auto_parallel.meta_profiler import ShardMetaInfo
  from colossalai.auto_parallel.passes.runtime_apply_pass import runtime_apply, runtime_comm_spec_apply
  from colossalai.auto_parallel.tensor_shard.sharding_strategy import MemoryCost, TrainCycleItem
  from colossalai.tensor.comm_spec import CommSpec
  from colossalai.tensor.shape_consistency import ShapeConsistencyManager
  from colossalai.tensor.sharding_spec import ShardingSpec
label_desc: Use image node_id 3 for calling a global function with example usage: _runtime_comm_spec_apply_meta_info(node, comm_actions_dict) and returns: meta_info