code: def comm_actions_for_oprands(
      node: Node,
      removed_dims: List[int],
      op_data: OperationData,
      sharding_spec: ShardingSpec,
  ) -> CommAction:
      """
      This method is used to generate communication actions for oprands which lose information
      during convert logical shape to physical shape.
      """
      if len(removed_dims) == 1:
          # if list length is 1, extract element from list to avoid using flatten device mesh
          removed_dims = removed_dims[0]
      comm_spec = CommSpec(
          comm_pattern=CollectiveCommPattern.IDENTITY_FWD_ALLREDUCE_BWD,
          sharding_spec=sharding_spec,
          logical_process_axis=removed_dims,
      )
      if op_data.type == OperationDataType.PARAM:
          comm_type = CommType.HOOK
      else:
          comm_type = CommType.BEFORE
      arg_index = -1
      for index, arg in enumerate(node.args):
          if op_data.name == str(arg):
              arg_index = index
      assert arg_index >= 0, f"op_data should be an argument of node."
      comm_action = CommAction(
          comm_spec=comm_spec,
          comm_type=comm_type,
          arg_index=arg_index,
      )
      return comm_action
  
file_path: ColossalAI/colossalai/auto_parallel/tensor_shard/utils/broadcast.py
imports: from enum import Enum, auto
  from typing import List
  import torch
  from torch.fx.node import Node
  from colossalai.auto_parallel.tensor_shard.sharding_strategy import CommAction, CommType, OperationData, OperationDataType
  from colossalai.tensor.comm_spec import CollectiveCommPattern, CommSpec
  from colossalai.tensor.sharding_spec import ShardingSpec
label_desc: Use image node_id 5 for calling a global function with example usage: comm_actions_for_oprands(node, removed_dims, op_data, sharding_spec) and returns: comm_action