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",",",")"]
docstr: Args:
      dense_features (torch.Tensor): the dense features.
      sparse_features (KeyedJaggedTensor): the sparse features.
  
  Returns:
      torch.Tensor: logits with size B X 1.
docstr_tok: ["Args",":","dense_features","(","torch.Tensor",")",":","the","dense","features",".","sparse_features","(","KeyedJaggedTensor",")",":","the","sparse","features",".","Returns",":","torch.Tensor",":","logits","with","size","B","X","1","."]
code: def forward(
      self,
      dense_features: torch.Tensor,
      sparse_features: KeyedJaggedTensor,
  ) -> torch.Tensor:
      """
      Args:
          dense_features (torch.Tensor): the dense features.
          sparse_features (KeyedJaggedTensor): the sparse features.
  
      Returns:
          torch.Tensor: logits with size B X 1.
      """
      embedded_dense = self.dense_arch(dense_features)
      embedded_sparse = self.sparse_arch(sparse_features)
      concatenated_dense = self.inter_arch(
          dense_features=embedded_dense, sparse_features=embedded_sparse
      )
      logits = self.over_arch(concatenated_dense)
      return logits
  
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 2 for calling the SimpleDeepFMNN obj's underlying member method code with example usage: obj.forward(dense_features, sparse_features) and returns: logits