code: def check_all_reduce_bwd(device_mesh, rank):
      # tensor to comm
      tensor_to_comm = torch.ones(2, 2).cuda() * rank
  
      tensor_to_check = torch.ones(2, 2).cuda() * rank
  
      dim_partition_dict = {}
      # DistSpec:
      #     shard_sequence: R,R
      #     device_mesh_shape: (2, 2)
      sharding_spec = ShardingSpec(
          device_mesh,
          tensor_to_comm.shape,
          dim_partition_dict=dim_partition_dict,
      )
  
      comm_spec = CommSpec(
          CollectiveCommPattern.IDENTITY_FWD_ALLREDUCE_BWD,
          sharding_spec,
          logical_process_axis=0,
      )
      tensor_to_comm = comm_spec.covert_spec_to_action(tensor_to_comm)
  
      assert tensor_to_comm.equal(tensor_to_check)
  
file_path: colossalai/tests/test_tensor/test_comm_spec_apply.py
imports: import pytest
  import torch
  import torch.distributed
  from colossalai.device.device_mesh import DeviceMesh
  from colossalai.initialize import launch
  from colossalai.logging import disable_existing_loggers
  from colossalai.tensor.shape_consistency import CollectiveCommPattern, CommSpec
  from colossalai.tensor.sharding_spec import ShardingSpec
  from colossalai.testing import rerun_if_address_is_in_use, spawn
label_desc: Use image node_id 5 for calling a global function with example usage: check_all_reduce_bwd(device_mesh, rank) without return types