code: def shard(self, ebc: nn.Module) -> nn.Module:
      if not isinstance(ebc, CustomEmbeddingBagCollection):
          raise RuntimeError(
              "The custom sharder only supports CustomEmbeddingBagCollection"
          )
  
      return CustomShardedEBC(
          ebc,
          self.split_sharding_idx,
          (self.rowwise_spec, self.colwise_spec),
      )
  
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 CustomSharder obj's underlying member method code with example usage: obj.shard(ebc) and returns: CustomShardedEBC