class_docstr: Bilinear factorization representation.
  
  Encodes both users and items as an embedding layer; the score
  for a user-item pair is given by the dot product of the item
  and user latent vectors.
  
  Parameters
  ----------
  
  num_users: int
      Number of users in the model.
  num_items: int
      Number of items in the model.
  embedding_dim: int, optional
      Dimensionality of the latent representations.
  user_embedding_layer: an embedding layer, optional
      If supplied, will be used as the user embedding layer
      of the network.
  item_embedding_layer: an embedding layer, optional
      If supplied, will be used as the item embedding layer
      of the network.
  sparse: boolean, optional
      Use sparse gradients.
class_docstr_tok: ["Bilinear","factorization","representation",".","Encodes","both","users","and","items","as","an","embedding","layer",";","the","score","for","a","user-item","pair","is","given","by","the","dot","product","of","the","item","and","user","latent","vectors",".","Parameters","--","--","--","--","--","num_users",":","int","Number","of","users","in","the","model",".","num_items",":","int","Number","of","items","in","the","model",".","embedding_dim",":","int",",","optional","Dimensionality","of","the","latent","representations",".","user_embedding_layer",":","an","embedding","layer",",","optional","If","supplied",",","will","be","used","as","the","user","embedding","layer","of","the","network",".","item_embedding_layer",":","an","embedding","layer",",","optional","If","supplied",",","will","be","used","as","the","item","embedding","layer","of","the","network",".","sparse",":","boolean",",","optional","Use","sparse","gradients","."]
docstr: Compute the forward pass of the representation.
  
  Parameters
  ----------
  
  user_ids: tensor
      Tensor of user indices.
  item_ids: tensor
      Tensor of item indices.
  
  Returns
  -------
  
  predictions: tensor
      Tensor of predictions.
docstr_tok: ["Compute","the","forward","pass","of","the","representation",".","Parameters","--","--","--","--","--","user_ids",":","tensor","Tensor","of","user","indices",".","item_ids",":","tensor","Tensor","of","item","indices",".","Returns","--","--","--","-","predictions",":","tensor","Tensor","of","predictions","."]
code: def forward(self, user_ids, item_ids):
      """
      Compute the forward pass of the representation.
  
      Parameters
      ----------
  
      user_ids: tensor
          Tensor of user indices.
      item_ids: tensor
          Tensor of item indices.
  
      Returns
      -------
  
      predictions: tensor
          Tensor of predictions.
      """
  
      user_embedding = self.user_embeddings(user_ids)
      item_embedding = self.item_embeddings(item_ids)
  
      user_embedding = user_embedding.squeeze()
      item_embedding = item_embedding.squeeze()
  
      user_bias = self.user_biases(user_ids).squeeze()
      item_bias = self.item_biases(item_ids).squeeze()
  
      dot = (user_embedding * item_embedding).sum(1)
  
      return dot + user_bias + item_bias
  
imports: import torch.nn
  from spotlight.layers import ScaledEmbedding, ZeroEmbedding
label_desc: Use image node_id 2 for calling the BilinearNet obj's underlying member method code with example usage: obj.forward(user_ids, item_ids) and returns: unknown