code: def __init__(
      self,
      tables: List[EmbeddingBagConfig],
      device: torch.device,
      return_remapped: bool = False,
      mch_size: Optional[int] = None,
  ) -> None:
      super().__init__()
      self._return_remapped = return_remapped
  
      def mch_hash_func(
          id: torch.Tensor, hash_size: int
      ) -> torch.Tensor:
          return id % hash_size
  
      mc_modules = {}
      mc_modules["table_0"] = MCHManagedCollisionModule(
          zch_size=tables[0].num_embeddings - mch_size
          if mch_size
          else tables[0].num_embeddings,
          mch_size=mch_size,
          mch_hash_func=mch_hash_func if mch_size else None,
          input_hash_size=4000,
          device=device,
          eviction_interval=2,
          eviction_policy=DistanceLFU_EvictionPolicy(),
      )
  
      mc_modules["table_1"] = MCHManagedCollisionModule(
          zch_size=tables[1].num_embeddings - mch_size
          if mch_size
          else tables[1].num_embeddings,
          mch_size=mch_size,
          mch_hash_func=mch_hash_func if mch_size else None,
          device=device,
          input_hash_size=4000,
          eviction_interval=2,
          eviction_policy=DistanceLFU_EvictionPolicy(),
      )
  
      self._mc_ebc: ManagedCollisionEmbeddingBagCollection = ManagedCollisionEmbeddingBagCollection(
          EmbeddingBagCollection(
              tables=tables,
              device=device,
          ),
          ManagedCollisionCollection(
              managed_collision_modules=mc_modules,
              # pyre-ignore
              embedding_configs=tables,
          ),
          return_remapped_features=self._return_remapped,
      )
  
imports: import copy
  import unittest
  from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn
  from hypothesis import given, settings, strategies
  from torchrec.distributed.embeddingbag import ShardedEmbeddingBagCollection
  from torchrec.distributed.mc_embeddingbag import ManagedCollisionEmbeddingBagCollectionSharder, ShardedManagedCollisionEmbeddingBagCollection
  from torchrec.distributed.mc_modules import ShardedManagedCollisionCollection
  from torchrec.distributed.shard import _shard_modules
  from torchrec.distributed.sharding_plan import construct_module_sharding_plan, row_wise
  from torchrec.distributed.test_utils.multi_process import MultiProcessContext, MultiProcessTestBase
  from torchrec.distributed.types import ModuleSharder, ShardingEnv, ShardingPlan
  from torchrec.modules.embedding_configs import EmbeddingBagConfig
  from torchrec.modules.embedding_modules import EmbeddingBagCollection
  from torchrec.modules.mc_embedding_modules import ManagedCollisionEmbeddingBagCollection
  from torchrec.modules.mc_modules import DistanceLFU_EvictionPolicy, ManagedCollisionCollection, MCHManagedCollisionModule
  from torchrec.optim.apply_optimizer_in_backward import apply_optimizer_in_backward
  from torchrec.optim.rowwise_adagrad import RowWiseAdagrad
  from torchrec.sparse.jagged_tensor import JaggedTensor, KeyedJaggedTensor
  from torchrec.test_utils import skip_if_asan_class
label_desc: Use image node_id 1 to create a new SparseArch object from inherited base classes: nn with example: obj = SparseArch(tables, device, return_remapped, mch_size)