class_docstr: Recsys model from "Deep Learning Recommendation Model for Personalization and
  Recommendation Systems" (https://arxiv.org/abs/1906.00091). Processes sparse
  features by learning pooled embeddings for each feature. On the interaction layer,
  the relationship between dense features and sparse features is learned through a transformer encoder layer
  https://arxiv.org/abs/1706.03762.
  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.
      nhead: int: Number of multi-attention heads
      ntransformer_layers: int: Number of transformer encoder layers
      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_Transformer(
         embedding_bag_collection=ebc,
         dense_in_features=100,
         dense_arch_layer_sizes=[20],
         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],
      nhead: int = 8,
      ntransformer_layers: int = 4,
      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
      )
      self.inter_arch = InteractionTransformerArch(
          num_sparse_features=num_sparse_features,
          embedding_dim=embedding_dim,
          nhead=nhead,
          ntransformer_layers=ntransformer_layers,
      )
      over_in_features: int = (num_sparse_features + 1) * embedding_dim
      self.over_arch = OverArch(
          in_features=over_in_features,
          layer_sizes=over_arch_layer_sizes,
          device=dense_device,
      )
  
file_path: torchrec/torchrec/models/experimental/transformerdlrm.py
imports: from typing import List, Optional
  import torch
  from torch import nn
  from torchrec.models.dlrm import DLRM, OverArch
  from torchrec.modules.embedding_modules import EmbeddingBagCollection
label_desc: Use image node_id 1 to create a new DLRM_Transformer object from inherited base classes: DLRM with example: obj = DLRM_Transformer(embedding_bag_collection, dense_in_features, dense_arch_layer_sizes, over_arch_layer_sizes, nhead, ntransformer_layers, dense_device)