class_docstr: Recsys model modified from the original model from "Deep Learning Recommendation
  Model for Personalization and Recommendation Systems"
  (https://arxiv.org/abs/1906.00091). Similar to DLRM module but has
  additional MLPs in the interaction layer (along 2 branches).
  
  The module assumes all sparse features have the same embedding dimension
  (i.e. each EmbeddingBagConfig uses the same embedding_dim).
  
  The following notation is used throughout the documentation for the models:
  
  * F: number of sparse features
  * D: embedding_dimension of sparse features
  * B: batch size
  * num_features: number of dense features
  
  Args:
      embedding_bag_collection (EmbeddingBagCollection): collection of embedding bags
          used to define `SparseArch`.
      dense_in_features (int): the dimensionality of the dense input features.
      dense_arch_layer_sizes (List[int]): the layer sizes for the `DenseArch`.
      over_arch_layer_sizes (List[int]): the layer sizes for the `OverArch`.
          The output dimension of the `InteractionArch` should not be manually
          specified here.
      interaction_branch1_layer_sizes (List[int]): the layer sizes for first branch of
          interaction layer. The output dimension must be a multiple of D.
      interaction_branch2_layer_sizes (List[int]):the layer sizes for second branch of
          interaction layer. The output dimension must be a multiple of D.
      dense_device (Optional[torch.device]): default compute device.
  
  Example::
  
      B = 2
      D = 8
  
      eb1_config = EmbeddingBagConfig(
         name="t1", embedding_dim=D, num_embeddings=100, feature_names=["f1", "f3"]
      )
      eb2_config = EmbeddingBagConfig(
         name="t2",
         embedding_dim=D,
         num_embeddings=100,
         feature_names=["f2"],
      )
  
      ebc = EmbeddingBagCollection(tables=[eb1_config, eb2_config])
      model = DLRM_Projection(
         embedding_bag_collection=ebc,
         dense_in_features=100,
         dense_arch_layer_sizes=[20, D],
         interaction_branch1_layer_sizes=[3*D+D, 4*D],
         interaction_branch2_layer_sizes=[3*D+D, 4*D],
         over_arch_layer_sizes=[5, 1],
      )
  
      features = torch.rand((B, 100))
  
      #     0       1
      # 0   [1,2] [4,5]
      # 1   [4,3] [2,9]
      # ^
      # feature
      sparse_features = KeyedJaggedTensor.from_offsets_sync(
         keys=["f1", "f3"],
         values=torch.tensor([1, 2, 4, 5, 4, 3, 2, 9]),
         offsets=torch.tensor([0, 2, 4, 6, 8]),
      )
  
      logits = model(
         dense_features=features,
         sparse_features=sparse_features,
      )
class_docstr_tok: ["Recsys","model","modified","from","the","original","model","from","``","Deep","Learning","Recommendation","Model","for","Personalization","and","Recommendation","Systems","''","(","https",":","\/\/arxiv.org\/abs\/1906.00091",")",".","Similar","to","DLRM","module","but","has","additional","MLPs","in","the","interaction","layer","(","along","2","branches",")",".","The","module","assumes","all","sparse","features","have","the","same","embedding","dimension","(","i.e",".","each","EmbeddingBagConfig","uses","the","same","embedding_dim",")",".","The","following","notation","is","used","throughout","the","documentation","for","the","models",":","*","F",":","number","of","sparse","features","*","D",":","embedding_dimension","of","sparse","features","*","B",":","batch","size","*","num_features",":","number","of","dense","features","Args",":","embedding_bag_collection","(","EmbeddingBagCollection",")",":","collection","of","embedding","bags","used","to","define","`","SparseArch","`",".","dense_in_features","(","int",")",":","the","dimensionality","of","the","dense","input","features",".","dense_arch_layer_sizes","(","List","[","int","]",")",":","the","layer","sizes","for","the","`","DenseArch","`",".","over_arch_layer_sizes","(","List","[","int","]",")",":","the","layer","sizes","for","the","`","OverArch","`",".","The","output","dimension","of","the","`","InteractionArch","`","should","not","be","manually","specified","here",".","interaction_branch1_layer_sizes","(","List","[","int","]",")",":","the","layer","sizes","for","first","branch","of","interaction","layer",".","The","output","dimension","must","be","a","multiple","of","D.","interaction_branch2_layer_sizes","(","List","[","int","]",")",":","the","layer","sizes","for","second","branch","of","interaction","layer",".","The","output","dimension","must","be","a","multiple","of","D.","dense_device","(","Optional","[","torch.device","]",")",":","default","compute","device",".","Example",":",":","B","=","2","D","=","8","eb1_config","=","EmbeddingBagConfig","(","name=","''","t1","''",",","embedding_dim=D",",","num_embeddings=100",",","feature_names=","[","``","f1","''",",","``","f3","''","]",")","eb2_config","=","EmbeddingBagConfig","(","name=","''","t2","''",",","embedding_dim=D",",","num_embeddings=100",",","feature_names=","[","``","f2","''","]",",",")","ebc","=","EmbeddingBagCollection","(","tables=","[","eb1_config",",","eb2_config","]",")","model","=","DLRM_Projection","(","embedding_bag_collection=ebc",",","dense_in_features=100",",","dense_arch_layer_sizes=","[","20",",","D","]",",","interaction_branch1_layer_sizes=","[","3","*","D+D",",","4","*","D","]",",","interaction_branch2_layer_sizes=","[","3","*","D+D",",","4","*","D","]",",","over_arch_layer_sizes=","[","5",",","1","]",",",")","features","=","torch.rand","(","(","B",",","100",")",")","#","0","1","#","0","[","1,2","]","[","4,5","]","#","1","[","4,3","]","[","2,9","]","#","^","#","feature","sparse_features","=","KeyedJaggedTensor.from_offsets_sync","(","keys=","[","``","f1","''",",","``","f3","''","]",",","values=torch.tensor","(","[","1",",","2",",","4",",","5",",","4",",","3",",","2",",","9","]",")",",","offsets=torch.tensor","(","[","0",",","2",",","4",",","6",",","8","]",")",",",")","logits","=","model","(","dense_features=features",",","sparse_features=sparse_features",",",")"]
code: def __init__(
      self,
      embedding_bag_collection: EmbeddingBagCollection,
      dense_in_features: int,
      dense_arch_layer_sizes: List[int],
      over_arch_layer_sizes: List[int],
      interaction_branch1_layer_sizes: List[int],
      interaction_branch2_layer_sizes: List[int],
      dense_device: Optional[torch.device] = None,
  ) -> None:
      # initialize DLRM
      # sparse arch and dense arch are initialized via DLRM
      super().__init__(
          embedding_bag_collection,
          dense_in_features,
          dense_arch_layer_sizes,
          over_arch_layer_sizes,
          dense_device,
      )
  
      embedding_dim: int = (
          embedding_bag_collection.embedding_bag_configs()[
              0
          ].embedding_dim
      )
      num_sparse_features: int = len(
          self.sparse_arch.sparse_feature_names
      )
  
      # Fix interaction and over arch for DLRM_Projeciton
      if interaction_branch1_layer_sizes[-1] % embedding_dim != 0:
          raise ValueError(
              "Final interaction branch1 layer size "
              "({}) is not a multiple of embedding size ({})".format(
                  interaction_branch1_layer_sizes[-1], embedding_dim
              )
          )
      projected_dim_1: int = (
          interaction_branch1_layer_sizes[-1] // embedding_dim
      )
      interaction_branch1 = DenseArch(
          in_features=num_sparse_features * embedding_dim
          + dense_arch_layer_sizes[-1],
          layer_sizes=interaction_branch1_layer_sizes,
          device=dense_device,
      )
  
      if interaction_branch2_layer_sizes[-1] % embedding_dim != 0:
          raise ValueError(
              "Final interaction branch2 layer size "
              "({}) is not a multiple of embedding size ({})".format(
                  interaction_branch2_layer_sizes[-1], embedding_dim
              )
          )
      projected_dim_2: int = (
          interaction_branch2_layer_sizes[-1] // embedding_dim
      )
      interaction_branch2 = DenseArch(
          in_features=num_sparse_features * embedding_dim
          + dense_arch_layer_sizes[-1],
          layer_sizes=interaction_branch2_layer_sizes,
          device=dense_device,
      )
  
      self.inter_arch = InteractionProjectionArch(
          num_sparse_features=num_sparse_features,
          interaction_branch1=interaction_branch1,
          interaction_branch2=interaction_branch2,
      )
  
      over_in_features: int = (
          embedding_dim + projected_dim_1 * projected_dim_2
      )
  
      self.over_arch = OverArch(
          in_features=over_in_features,
          layer_sizes=over_arch_layer_sizes,
          device=dense_device,
      )
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn
  from torchrec.datasets.utils import Batch
  from torchrec.modules.crossnet import LowRankCrossNet
  from torchrec.modules.embedding_modules import EmbeddingBagCollection
  from torchrec.modules.mlp import MLP
  from torchrec.sparse.jagged_tensor import KeyedJaggedTensor, KeyedTensor
label_desc: Use image node_id 1 to create a new DLRM_Projection object from inherited base classes: DLRM with example: obj = DLRM_Projection(embedding_bag_collection, dense_in_features, dense_arch_layer_sizes, over_arch_layer_sizes, interaction_branch1_layer_sizes, interaction_branch2_layer_sizes, dense_device)