class_docstr: KSR integrates the RNN-based networks with Key-Value Memory Network (KV-MN).
  And it further incorporates knowledge base (KB) information to enhance the semantic representation of KV-MN.
class_docstr_tok: ["KSR","integrates","the","RNN-based","networks","with","Key-Value","Memory","Network","(","KV-MN",")",".","And","it","further","incorporates","knowledge","base","(","KB",")","information","to","enhance","the","semantic","representation","of","KV-MN","."]
docstr: Difference:
  We generate the embeddings of the tail entities on every relations only for head due to the 1-N problems.
docstr_tok: ["Difference",":","We","generate","the","embeddings","of","the","tail","entities","on","every","relations","only","for","head","due","to","the","1-N","problems","."]
code: def _get_kg_embedding(self, head):
      """Difference:
      We generate the embeddings of the tail entities on every relations only for head due to the 1-N problems.
      """
      head_e = self.entity_embedding(head)  # [B K]
      relation_Matrix = self.relation_Matrix.unsqueeze(0).repeat(
          head_e.size()[0], 1, 1
      )  # [B R K]
      head_Matrix = torch.unsqueeze(head_e, 1).repeat(
          1, self.n_relations, 1
      )  # [B R K]
      tail_Matrix = head_Matrix + relation_Matrix
  
      return head_e, tail_Matrix
  
file_path: RecBole/recbole/model/sequential_recommender/ksr.py
imports: import torch
  from torch import nn
  from torch.nn.init import xavier_uniform_, xavier_normal_
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.loss import BPRLoss
label_desc: Use image node_id 3 for calling the KSR obj's underlying member method code with example usage: obj._get_kg_embedding(head) and returns: head_e,  tail_Matrix