class_docstr: This is Field-Aware Factorization Machine Module for FFM.
docstr: Model the different interaction strengths of different field pairs.
  
  
  Args:
      input_x (a tuple): (token_ffm_input, float_ffm_input, token_seq_ffm_input)
  
              token_ffm_input (torch.cuda.FloatTensor): [batch_size, num_token_features] or None
  
              float_ffm_input (torch.cuda.FloatTensor): [batch_size, num_float_features] or None
  
              token_seq_ffm_input (list): length is num_token_seq_features or 0
  
  Returns:
      torch.cuda.FloatTensor: The results of all features' field-aware interactions.
      shape: [batch_size, num_fields, emb_dim]
docstr_tok: ["Model","the","different","interaction","strengths","of","different","field","pairs",".","Args",":","input_x","(","a","tuple",")",":","(","token_ffm_input",",","float_ffm_input",",","token_seq_ffm_input",")","token_ffm_input","(","torch.cuda.FloatTensor",")",":","[","batch_size",",","num_token_features","]","or","None","float_ffm_input","(","torch.cuda.FloatTensor",")",":","[","batch_size",",","num_float_features","]","or","None","token_seq_ffm_input","(","list",")",":","length","is","num_token_seq_features","or","0","Returns",":","torch.cuda.FloatTensor",":","The","results","of","all","features","'","field-aware","interactions",".","shape",":","[","batch_size",",","num_fields",",","emb_dim","]"]
code: def forward(self, input_x):
      r"""Model the different interaction strengths of different field pairs.
  
  
      Args:
          input_x (a tuple): (token_ffm_input, float_ffm_input, token_seq_ffm_input)
  
                  token_ffm_input (torch.cuda.FloatTensor): [batch_size, num_token_features] or None
  
                  float_ffm_input (torch.cuda.FloatTensor): [batch_size, num_float_features] or None
  
                  token_seq_ffm_input (list): length is num_token_seq_features or 0
  
      Returns:
          torch.cuda.FloatTensor: The results of all features' field-aware interactions.
          shape: [batch_size, num_fields, emb_dim]
      """
      (
          token_ffm_input,
          float_ffm_input,
          token_seq_ffm_input,
          float_seq_ffm_input,
      ) = (
          input_x[0],
          input_x[1],
          input_x[2],
          input_x[3],
      )
  
      token_input_x_emb = self._emb_token_ffm_input(token_ffm_input)
      float_input_x_emb = self._emb_float_ffm_input(float_ffm_input)
      token_seq_input_x_emb = self._emb_token_seq_ffm_input(
          token_seq_ffm_input
      )
      float_seq_input_x_emb = self._emb_float_seq_ffm_input(
          float_seq_ffm_input
      )
  
      input_x_emb = self._get_input_x_emb(
          token_input_x_emb,
          float_input_x_emb,
          token_seq_input_x_emb,
          float_seq_input_x_emb,
      )
  
      output = list()
      for i in range(self.num_features - 1):
          for j in range(i + 1, self.num_features):
              output.append(
                  input_x_emb[self.feature2field[j]][:, i]
                  * input_x_emb[self.feature2field[i]][:, j]
              )
      output = torch.stack(
          output, dim=1
      )  # [batch_size, num_fields, emb_dim]
  
      return output
  
imports: import numpy
  import torch
  import torch.nn
  from torch.nn.init import xavier_normal_, constant_
  from recbole.model.abstract_recommender import ContextRecommender
label_desc: Use image node_id 2 for calling the FieldAwareFactorizationMachine obj's underlying member method code with example usage: obj.forward(input_x) and returns: output