class_docstr: HGN sets feature gating and instance gating to get the important feature and item for predicting the next item
docstr: choose the last click items that will influence the prediction( more important more chance to get attention)
docstr_tok: ["choose","the","last","click","items","that","will","influence","the","prediction","(","more","important","more","chance","to","get","attention",")"]
code: def instance_gating(self, user_item, user_embedding):
      """
  
      choose the last click items that will influence the prediction( more important more chance to get attention)
      """
  
      user_embedding_value = user_item
  
      user_item = self.w3(user_item)
      # batch_size * seq_len * 1
  
      user_embedding = self.w4(user_embedding).unsqueeze(2)
      # batch_size * seq_len * 1
  
      instance_score = self.sigmoid(user_item + user_embedding).squeeze(
          -1
      )
      # batch_size * seq_len * 1
      output = torch.mul(
          instance_score.unsqueeze(2), user_embedding_value
      )
      # batch_size * seq_len * embedding_size
  
      if self.pool_type == "average":
          output = torch.div(
              output.sum(dim=1), instance_score.sum(dim=1).unsqueeze(1)
          )
          # batch_size * embedding_size
      else:
          # for max_pooling
          index = torch.max(instance_score, dim=1)[1]
          # batch_size * 1
          output = self.gather_indexes(output, index)
          # batch_size * seq_len * embedding_size ==>> batch_size * embedding_size
  
      return output
  
file_path: RecBole/recbole/model/sequential_recommender/hgn.py
imports: import torch
  import torch.nn
  from torch.nn.init import xavier_uniform_, constant_, normal_
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.loss import BPRLoss
label_desc: Use image node_id 5 for calling the HGN obj's underlying member method code with example usage: obj.instance_gating(user_item, user_embedding) and returns: output