class_docstr: Basic recsys module with DeepFM arch. Processes sparse features by
  learning pooled embeddings for each feature. Learns the relationship between
  dense features and sparse features by projecting dense features into the same
  embedding space. Learns the interaction among those dense and sparse features
  by deep_fm proposed in this paper: https://arxiv.org/pdf/1703.04247.pdf
  
  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:
      num_dense_features (int): the number of input dense features.
      embedding_bag_collection (EmbeddingBagCollection): collection of embedding bags
          used to define `SparseArch`.
      hidden_layer_size (int): the hidden layer size used in dense module.
      deep_fm_dimension (int): the output layer size used in `deep_fm`'s deep
          interaction module.
  
  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])
      sparse_nn = SimpleDeepFMNN(
          embedding_bag_collection=ebc, hidden_layer_size=20, over_embedding_dim=5
      )
  
      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 = sparse_nn(
          dense_features=features,
          sparse_features=sparse_features,
      )
class_docstr_tok: ["Basic","recsys","module","with","DeepFM","arch",".","Processes","sparse","features","by","learning","pooled","embeddings","for","each","feature",".","Learns","the","relationship","between","dense","features","and","sparse","features","by","projecting","dense","features","into","the","same","embedding","space",".","Learns","the","interaction","among","those","dense","and","sparse","features","by","deep_fm","proposed","in","this","paper",":","https",":","\/\/arxiv.org\/pdf\/1703.04247.pdf","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",":","num_dense_features","(","int",")",":","the","number","of","input","dense","features",".","embedding_bag_collection","(","EmbeddingBagCollection",")",":","collection","of","embedding","bags","used","to","define","`","SparseArch","`",".","hidden_layer_size","(","int",")",":","the","hidden","layer","size","used","in","dense","module",".","deep_fm_dimension","(","int",")",":","the","output","layer","size","used","in","`","deep_fm","`","'s","deep","interaction","module",".","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","]",")","sparse_nn","=","SimpleDeepFMNN","(","embedding_bag_collection=ebc",",","hidden_layer_size=20",",","over_embedding_dim=5",")","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","=","sparse_nn","(","dense_features=features",",","sparse_features=sparse_features",",",")"]
code: def __init__(
      self,
      num_dense_features: int,
      embedding_bag_collection: EmbeddingBagCollection,
      hidden_layer_size: int,
      deep_fm_dimension: int,
  ) -> None:
      super().__init__()
      assert (
          len(embedding_bag_collection.embedding_bag_configs()) > 0
      ), "At least one embedding bag is required"
      for i in range(
          1, len(embedding_bag_collection.embedding_bag_configs())
      ):
          conf_prev = embedding_bag_collection.embedding_bag_configs()[
              i - 1
          ]
          conf = embedding_bag_collection.embedding_bag_configs()[i]
          assert (
              conf_prev.embedding_dim == conf.embedding_dim
          ), "All EmbeddingBagConfigs must have the same dimension"
      embedding_dim: int = (
          embedding_bag_collection.embedding_bag_configs()[
              0
          ].embedding_dim
      )
  
      feature_names = []
  
      fm_in_features = embedding_dim
      for conf in embedding_bag_collection.embedding_bag_configs():
          for feat in conf.feature_names:
              feature_names.append(feat)
              fm_in_features += conf.embedding_dim
  
      self.sparse_arch = SparseArch(embedding_bag_collection)
      self.dense_arch = DenseArch(
          in_features=num_dense_features,
          hidden_layer_size=hidden_layer_size,
          embedding_dim=embedding_dim,
      )
      self.inter_arch = FMInteractionArch(
          fm_in_features=fm_in_features,
          sparse_feature_names=feature_names,
          deep_fm_dimension=deep_fm_dimension,
      )
      over_in_features = embedding_dim + deep_fm_dimension + 1
      self.over_arch = OverArch(over_in_features)
  
imports: from typing import List
  import torch
  from torch import nn
  from torchrec import EmbeddingBagCollection, KeyedJaggedTensor
  from torchrec.modules.deepfm import DeepFM, FactorizationMachine
  from torchrec.sparse.jagged_tensor import KeyedTensor
label_desc: Use image node_id 1 to create a new SimpleDeepFMNN object from inherited base classes: nn with example: obj = SimpleDeepFMNN(num_dense_features, embedding_bag_collection, hidden_layer_size, deep_fm_dimension)