class_docstr: A representation that models users as mixtures-of-tastes.
  
  This is accomplished via an LSTM with a layer on top that
  projects the last hidden state taste vectors and
  taste attention vectors that match items with the taste
  vectors that are best for evaluating them.
  
  For a full description of the model, see [5]_.
  
  Parameters
  ----------
  
  num_items: int
      Number of items to be represented.
  embedding_dim: int, optional
      Embedding dimension of the embedding layer, and the number of hidden
      units in the LSTM layer.
  num_mixtures: int, optional
      Number of mixture components (distinct user tastes) that
      the network should model.
  item_embedding_layer: an embedding layer, optional
      If supplied, will be used as the item embedding layer
      of the network.
  
  References
  ----------
  
  .. [5] Kula, Maciej. "Mixture-of-tastes Models for Representing
     Users with Diverse Interests" https://github.com/maciejkula/mixture (2017)
class_docstr_tok: ["A","representation","that","models","users","as","mixtures-of-tastes",".","This","is","accomplished","via","an","LSTM","with","a","layer","on","top","that","projects","the","last","hidden","state","taste","vectors","and","taste","attention","vectors","that","match","items","with","the","taste","vectors","that","are","best","for","evaluating","them",".","For","a","full","description","of","the","model",",","see","[","5","]","_.","Parameters","--","--","--","--","--","num_items",":","int","Number","of","items","to","be","represented",".","embedding_dim",":","int",",","optional","Embedding","dimension","of","the","embedding","layer",",","and","the","number","of","hidden","units","in","the","LSTM","layer",".","num_mixtures",":","int",",","optional","Number","of","mixture","components","(","distinct","user","tastes",")","that","the","network","should","model",".","item_embedding_layer",":","an","embedding","layer",",","optional","If","supplied",",","will","be","used","as","the","item","embedding","layer","of","the","network",".","References","--","--","--","--","--","..","[","5","]","Kula",",","Maciej",".","``","Mixture-of-tastes","Models","for","Representing","Users","with","Diverse","Interests","''","https",":","\/\/github.com\/maciejkula\/mixture","(","2017",")"]
docstr: Compute predictions for target items given user representations.
  
  Parameters
  ----------
  
  user_representations: tensor
      Result of the user_representation_method.
  targets: tensor
      A minibatch of item sequences of shape
      (minibatch_size, sequence_length).
  
  Returns
  -------
  
  predictions: tensor
      of shape (minibatch_size, sequence_length)
docstr_tok: ["Compute","predictions","for","target","items","given","user","representations",".","Parameters","--","--","--","--","--","user_representations",":","tensor","Result","of","the","user_representation_method",".","targets",":","tensor","A","minibatch","of","item","sequences","of","shape","(","minibatch_size",",","sequence_length",")",".","Returns","--","--","--","-","predictions",":","tensor","of","shape","(","minibatch_size",",","sequence_length",")"]
code: def forward(self, user_representations, targets):
      """
      Compute predictions for target items given user representations.
  
      Parameters
      ----------
  
      user_representations: tensor
          Result of the user_representation_method.
      targets: tensor
          A minibatch of item sequences of shape
          (minibatch_size, sequence_length).
  
      Returns
      -------
  
      predictions: tensor
          of shape (minibatch_size, sequence_length)
      """
  
      user_components = user_representations[
          :, : self.num_mixtures, :, :
      ]
      mixture_vectors = user_representations[
          :, self.num_mixtures :, :, :
      ]
  
      target_embedding = self.item_embeddings(targets).permute(0, 2, 1)
      target_bias = self.item_biases(targets).squeeze()
  
      mixture_weights = mixture_vectors * target_embedding.unsqueeze(
          1
      ).expand_as(user_components)
      mixture_weights = (
          F.softmax(mixture_weights.sum(2), 1)
          .unsqueeze(2)
          .expand_as(user_components)
      )
      weighted_user_representations = (
          mixture_weights * user_components
      ).sum(1)
  
      dot = (
          (weighted_user_representations * target_embedding)
          .sum(1)
          .squeeze()
      )
  
      return target_bias + dot
  
imports: import torch
  from torch.backends import cudnn
  import torch.nn
  import torch.nn.functional
  from spotlight.layers import ScaledEmbedding, ZeroEmbedding
label_desc: Use image node_id 3 for calling the MixtureLSTMNet obj's underlying member method code with example usage: obj.forward(user_representations, targets) and returns: unknown