If you’re interested, I have also implemented a factorization machine in pytorch – I cythonized the forward and backward passes, and so it’s relatively fast. Definitely a work-in-progress still!

  
      
      GitHub
  
  
    

jmhessel/fmpytorch 107

fmpytorch - A PyTorch implementation of a Factorization Machine module in cython.