class_docstr: This is the Factorization Machine module, mentioned in the `DeepFM paper
  <https://arxiv.org/pdf/1703.04247.pdf>`_:
  
  This module does not cover the end-end functionality of the published paper.
  Instead, it covers only the FM part of the publication, and is used to learn
  2nd-order feature interactions.
  
  To support modeling flexibility, we customize the key components as different from
  the public paper:
      We change the input from raw sparse features to embeddings of the features.
      This allows flexibility in embedding dimensions and the number of embeddings,
      as long as all embedding tensors have the same batch size.
  
  The general architecture of the module is like::
  
                              1 x 10                  output
                               /|\
                                |                     pass into `dense_module`
                                |
                              1 x 90
                               /|\
                                |                     concat
                                |
                      1 x 20, 1 x 30, 1 x 40          list of embeddings
  
  Example::
  
      batch_size = 3
      # the input embedding are in torch.Tensor of [batch_size, num_embeddings, embedding_dim]
      input_embeddings = [
          torch.randn(batch_size, 2, 64),
          torch.randn(batch_size, 2, 32),
      ]
      fm = FactorizationMachine()
      output = fm(embeddings=input_embeddings)
class_docstr_tok: ["This","is","the","Factorization","Machine","module",",","mentioned","in","the","`","DeepFM","paper","<","https",":","\/\/arxiv.org\/pdf\/1703.04247.pdf",">","`","_",":","This","module","does","not","cover","the","end-end","functionality","of","the","published","paper",".","Instead",",","it","covers","only","the","FM","part","of","the","publication",",","and","is","used","to","learn","2nd-order","feature","interactions",".","To","support","modeling","flexibility",",","we","customize","the","key","components","as","different","from","the","public","paper",":","We","change","the","input","from","raw","sparse","features","to","embeddings","of","the","features",".","This","allows","flexibility","in","embedding","dimensions","and","the","number","of","embeddings",",","as","long","as","all","embedding","tensors","have","the","same","batch","size",".","The","general","architecture","of","the","module","is","like",":",":","1","x","10","output","\/|\\","|","pass","into","`","dense_module","`","|","1","x","90","\/|\\","|","concat","|","1","x","20",",","1","x","30",",","1","x","40","list","of","embeddings","Example",":",":","batch_size","=","3","#","the","input","embedding","are","in","torch.Tensor","of","[","batch_size",",","num_embeddings",",","embedding_dim","]","input_embeddings","=","[","torch.randn","(","batch_size",",","2",",","64",")",",","torch.randn","(","batch_size",",","2",",","32",")",",","]","fm","=","FactorizationMachine","(",")","output","=","fm","(","embeddings=input_embeddings",")"]
code: def __init__(
      self,
  ) -> None:
      super().__init__()
  
file_path: torchrec/torchrec/modules/deepfm.py
imports: from typing import List
  import torch
  from torch import nn
  from torch.fx import wrap
label_desc: Use image node_id 1 to create a new FactorizationMachine object from inherited base classes: nn with example: obj = FactorizationMachine()