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",")"]
code: def __init__(
      self,
      num_items,
      embedding_dim=32,
      num_mixtures=4,
      item_embedding_layer=None,
      sparse=False,
  ):
      super(MixtureLSTMNet, self).__init__()
  
      self.embedding_dim = embedding_dim
      self.num_mixtures = num_mixtures
  
      if item_embedding_layer is not None:
          self.item_embeddings = item_embedding_layer
      else:
          self.item_embeddings = ScaledEmbedding(
              num_items,
              embedding_dim,
              padding_idx=PADDING_IDX,
              sparse=sparse,
          )
  
      self.item_biases = ZeroEmbedding(
          num_items, 1, sparse=sparse, padding_idx=PADDING_IDX
      )
  
      self.lstm = nn.LSTM(
          batch_first=True,
          input_size=embedding_dim,
          hidden_size=embedding_dim,
      )
      self.projection = nn.Conv1d(
          embedding_dim,
          embedding_dim * self.num_mixtures * 2,
          kernel_size=1,
      )
  
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 1 to create a new MixtureLSTMNet object from inherited base classes: nn with example: obj = MixtureLSTMNet(num_items, embedding_dim, num_mixtures, item_embedding_layer, sparse)