class_docstr: SHAN exploit the Hierarchical Attention Network to get the long-short term preference
  first get the long term purpose and then fuse the long-term with recent items to get long-short term purpose
class_docstr_tok: ["SHAN","exploit","the","Hierarchical","Attention","Network","to","get","the","long-short","term","preference","first","get","the","long","term","purpose","and","then","fuse","the","long-term","with","recent","items","to","get","long-short","term","purpose"]
docstr: get the long term purpose of user
docstr_tok: ["get","the","long","term","purpose","of","user"]
code: def long_term_attention_based_pooling_layer(
      self, seq_item_embedding, user_embedding, mask=None
  ):
      """
  
      get the long term purpose of user
      """
      seq_item_embedding_value = seq_item_embedding
  
      seq_item_embedding = self.relu(
          self.long_w(seq_item_embedding) + self.long_b
      )
      user_item_embedding = torch.matmul(
          seq_item_embedding, user_embedding.unsqueeze(2)
      ).squeeze(-1)
      # batch_size * seq_len
      if mask is not None:
          user_item_embedding.masked_fill_(mask, -1e9)
      user_item_embedding = nn.Softmax(dim=1)(user_item_embedding)
      user_item_embedding = torch.mul(
          seq_item_embedding_value, user_item_embedding.unsqueeze(2)
      ).sum(dim=1, keepdim=True)
      # batch_size * 1 * embedding_size
  
      return user_item_embedding
  
file_path: RecBole/recbole/model/sequential_recommender/shan.py
imports: import numpy
  import torch
  import torch.nn
  from torch.nn.init import normal_, uniform_
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.loss import BPRLoss
label_desc: Use image node_id 9 for calling the SHAN obj's underlying member method code with example usage: obj.long_term_attention_based_pooling_layer(seq_item_embedding, user_embedding, mask) and returns: user_item_embedding