code: def test_custom_sharder_errors(self):
      custom_sharder = CustomSharder(
          devices=[f"rank:{i}/cuda:{i}" for i in range(TEST_GPU_NUM)],
          split_sharding_idx=TEST_GPU_NUM // 2,
      )
  
      sharding_plan = ShardingPlan(
          plan={
              "": custom_sharder,
          }
      )
  
      sharded_model = CustomEmbeddingBagCollection(10, 10, 8).cuda(
          self.rank
      )
  
      with self.assertRaisesRegex(
          KeyError, "path must not be empty for custom sharder!"
      ):
          # shard the module with the provided sharding plan
          shard_module(sharded_model, sharding_plan)
  
      # test conflicted sharding plan
      spec = ChunkShardingSpec(
          dim=0, placements=["rank:0/cuda:0", "rank:1/cuda:1"]
      )
      sharding_plan = ShardingPlan(
          plan={
              "embedding_bags.embedding_bag_0.weight": spec,
              "embedding_bags": custom_sharder,
          }
      )
  
      with self.assertRaisesRegex(
          RuntimeError, "should not conflict with the submodule tree"
      ):
          # shard the module with the provided sharding plan
          shard_module(sharded_model, sharding_plan)
  
imports: import sys
  import copy
  import torch
  import torch.nn
  from torch.testing._internal.common_distributed import requires_nccl, skip_if_lt_x_gpu
  from torch.distributed._shard import shard_module
  from torch.distributed._shard.sharding_plan import ShardingPlan
  from torch.distributed._shard.sharder import Sharder
  from torch.distributed._shard.sharding_spec import ChunkShardingSpec
  from torch.distributed._shard.sharded_tensor import ShardedTensor
  from torch.testing._internal.common_utils import TEST_WITH_DEV_DBG_ASAN, run_tests
  from torch.testing._internal.distributed._shard.sharded_tensor import TEST_GPU_NUM, ShardedTensorTestBase, with_comms
label_desc: Use image node_id 2 for calling the TestCustomSharder obj's underlying member method code with example usage: obj.test_custom_sharder_errors() without return types