code: def get_broadcast_dim_info(logical_shape, physical_shape):
      # get the number of dimensions
      logical_num_dims = len(logical_shape)
      physical_num_dims = len(physical_shape)
  
      assert (
          logical_num_dims >= physical_num_dims
      ), "The number of dimensions in the logical shape is smaller than that of the physical shape, this tensor is not broadcast!"
  
      # track the dim and its broadcasting type
      logical_dim_broadcast_info = {}
  
      for i in range(logical_num_dims):
          # get the trailing dim size
          logical_dim_idx = logical_num_dims - i - 1
          physical_dim_idx = physical_num_dims - i - 1
          logical_dim_size = logical_shape[logical_dim_idx]
  
          if physical_dim_idx >= 0:
              physical_dim_size = physical_shape[physical_dim_idx]
  
              if physical_dim_size == logical_dim_size:
                  logical_dim_broadcast_info[
                      logical_dim_idx
                  ] = BroadcastType.EQUAL
              elif (
                  physical_dim_size == 1
                  and physical_dim_size != logical_dim_size
              ):
                  logical_dim_broadcast_info[
                      logical_dim_idx
                  ] = BroadcastType.MULTIPLE
          else:
              logical_dim_broadcast_info[
                  logical_dim_idx
              ] = BroadcastType.PADDING
  
      return logical_dim_broadcast_info
  
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 3 for calling a global function with example usage: get_broadcast_dim_info(logical_shape, physical_shape) and returns: logical_dim_broadcast_info