code: def test_fail_then_rerun(self) -> None:
      tables = [
          EmbeddingBagConfig(
              num_embeddings=4096,
              embedding_dim=128,
              name="table_" + str(i),
              feature_names=["feature_" + str(i)],
          )
          for i in range(1)
      ]
      model = TestSparseNN(
          tables=tables, sparse_device=torch.device("meta")
      )
  
      with self.assertRaises(PlannerError) as context:
          self.planner.plan(module=model, sharders=[TWSharder()])
      self.assertEqual(
          context.exception.error_type,
          PlannerErrorType.STRICT_CONSTRAINTS,
      )
  
      sharding_plan = self.planner.plan(
          module=model, sharders=[TWvsRWSharder()]
      )
      expected_ranks = [[0, 1]]
      ranks = [
          cast(List[int], param_shard.ranks)
          for param_shard in cast(
              EmbeddingModuleShardingPlan,
              sharding_plan.plan["sparse.ebc"],
          ).values()
      ]
  
      self.assertEqual(sorted(expected_ranks), sorted(ranks))
  
imports: import unittest
  from typing import cast, List
  import torch
  from torch import nn
  from torchrec.distributed.embedding_types import EmbeddingComputeKernel
  from torchrec.distributed.embeddingbag import EmbeddingBagCollectionSharder
  from torchrec.distributed.planner import ParameterConstraints
  from torchrec.distributed.planner.planners import EmbeddingShardingPlanner
  from torchrec.distributed.planner.types import PlannerError, PlannerErrorType, Topology
  from torchrec.distributed.sharding_plan import get_default_sharders
  from torchrec.distributed.test_utils.test_model import TestSparseNN
  from torchrec.distributed.types import BoundsCheckMode, CacheAlgorithm, CacheParams, DataType, EmbeddingModuleShardingPlan, ModuleSharder, ShardingPlan, ShardingType
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
label_desc: Use image node_id 5 for calling the TestEmbeddingShardingPlanner obj's underlying member method code with example usage: obj.test_fail_then_rerun() without return types