class_docstr: STAMP is capable of capturing users’ general interests from the long-term memory of a session context,
  whilst taking into account users’ current interests from the short-term memory of the last-clicks.
  
  
  Note:
  
      According to the test results, we made a little modification to the score function mentioned in the paper,
      and did not use the final sigmoid activation function.
class_docstr_tok: ["STAMP","is","capable","of","capturing","users","\u2019","general","interests","from","the","long-term","memory","of","a","session","context",",","whilst","taking","into","account","users","\u2019","current","interests","from","the","short-term","memory","of","the","last-clicks",".","Note",":","According","to","the","test","results",",","we","made","a","little","modification","to","the","score","function","mentioned","in","the","paper",",","and","did","not","use","the","final","sigmoid","activation","function","."]
docstr: This is a function that count the attention weights
  
  Args:
      context(torch.FloatTensor): Item list embedding matrix, shape of [batch_size, time_steps, emb]
      aspect(torch.FloatTensor): The embedding matrix of the last click item, shape of [batch_size, emb]
      output(torch.FloatTensor): The average of the context, shape of [batch_size, emb]
  
  Returns:
      torch.Tensor:attention weights, shape of [batch_size, time_steps]
docstr_tok: ["This","is","a","function","that","count","the","attention","weights","Args",":","context","(","torch.FloatTensor",")",":","Item","list","embedding","matrix",",","shape","of","[","batch_size",",","time_steps",",","emb","]","aspect","(","torch.FloatTensor",")",":","The","embedding","matrix","of","the","last","click","item",",","shape","of","[","batch_size",",","emb","]","output","(","torch.FloatTensor",")",":","The","average","of","the","context",",","shape","of","[","batch_size",",","emb","]","Returns",":","torch.Tensor",":","attention","weights",",","shape","of","[","batch_size",",","time_steps","]"]
code: def count_alpha(self, context, aspect, output):
      r"""This is a function that count the attention weights
  
      Args:
          context(torch.FloatTensor): Item list embedding matrix, shape of [batch_size, time_steps, emb]
          aspect(torch.FloatTensor): The embedding matrix of the last click item, shape of [batch_size, emb]
          output(torch.FloatTensor): The average of the context, shape of [batch_size, emb]
  
      Returns:
          torch.Tensor:attention weights, shape of [batch_size, time_steps]
      """
      timesteps = context.size(1)
      aspect_3dim = aspect.repeat(1, timesteps).view(
          -1, timesteps, self.embedding_size
      )
      output_3dim = output.repeat(1, timesteps).view(
          -1, timesteps, self.embedding_size
      )
      res_ctx = self.w1(context)
      res_asp = self.w2(aspect_3dim)
      res_output = self.w3(output_3dim)
      res_sum = res_ctx + res_asp + res_output + self.b_a
      res_act = self.w0(self.sigmoid(res_sum))
      alpha = res_act.squeeze(2)
      return alpha
  
file_path: RecBole/recbole/model/sequential_recommender/stamp.py
imports: import torch
  from torch import nn
  from torch.nn.init import normal_
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.loss import BPRLoss
label_desc: Use image node_id 4 for calling the STAMP obj's underlying member method code with example usage: obj.count_alpha(context, aspect, output) and returns: alpha