class_docstr: KGAT is a knowledge-based recommendation model. It combines knowledge graph and the user-item interaction
  graph to a new graph called collaborative knowledge graph (CKG). This model learns the representations of users and
  items by exploiting the structure of CKG. It adopts a GNN-based architecture and define the attention on the CKG.
class_docstr_tok: ["KGAT","is","a","knowledge-based","recommendation","model",".","It","combines","knowledge","graph","and","the","user-item","interaction","graph","to","a","new","graph","called","collaborative","knowledge","graph","(","CKG",")",".","This","model","learns","the","representations","of","users","and","items","by","exploiting","the","structure","of","CKG",".","It","adopts","a","GNN-based","architecture","and","define","the","attention","on","the","CKG","."]
docstr: Update the attention matrix using the updated embedding matrix
docstr_tok: ["Update","the","attention","matrix","using","the","updated","embedding","matrix"]
code: def update_attentive_A(self):
      r"""Update the attention matrix using the updated embedding matrix"""
  
      kg_score_list, row_list, col_list = [], [], []
      # To reduce the GPU memory consumption, we calculate the scores of KG triples according to the type of relation
      for rel_idx in range(1, self.n_relations, 1):
          triple_index = torch.where(self.all_rs == rel_idx)
          kg_score = self.generate_transE_score(
              self.all_hs[triple_index],
              self.all_ts[triple_index],
              rel_idx,
          )
          row_list.append(self.all_hs[triple_index])
          col_list.append(self.all_ts[triple_index])
          kg_score_list.append(kg_score)
      kg_score = torch.cat(kg_score_list, dim=0)
      row = torch.cat(row_list, dim=0)
      col = torch.cat(col_list, dim=0)
      indices = torch.cat([row, col], dim=0).view(2, -1)
      # Current PyTorch version does not support softmax on SparseCUDA, temporarily move to CPU to calculate softmax
      A_in = torch.sparse.FloatTensor(
          indices, kg_score, self.matrix_size
      ).cpu()
      A_in = torch.sparse.softmax(A_in, dim=1).to(self.device)
      self.A_in = A_in
  
imports: import numpy
  import scipy.sparse
  import torch
  import torch.nn
  import torch.nn.functional
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.loss import BPRLoss, EmbLoss
  from recbole.utils import InputType
label_desc: Use image node_id 9 for calling the KGAT obj's underlying member method code with example usage: obj.update_attentive_A() without return types