class_docstr: MKR is a Multi-task feature learning approach for Knowledge graph enhanced Recommendation. It is a deep
  end-to-end framework that utilizes knowledge graph embedding task to assist recommendation task. The two
  tasks are associated by cross&compress units, which automatically share latent features and learn high-order
  interactions between items in recommender systems and entities in the knowledge graph.
class_docstr_tok: ["MKR","is","a","Multi-task","feature","learning","approach","for","Knowledge","graph","enhanced","Recommendation",".","It","is","a","deep","end-to-end","framework","that","utilizes","knowledge","graph","embedding","task","to","assist","recommendation","task",".","The","two","tasks","are","associated","by","cross","&","compress","units",",","which","automatically","share","latent","features","and","learn","high-order","interactions","between","items","in","recommender","systems","and","entities","in","the","knowledge","graph","."]
code: def forward(
      self,
      user_indices=None,
      item_indices=None,
      head_indices=None,
      relation_indices=None,
      tail_indices=None,
  ):
      self.item_embeddings = self.item_embeddings_lookup(item_indices)
      self.head_embeddings = self.entity_embeddings_lookup(head_indices)
      self.item_embeddings, self.head_embeddings = self.cc_unit(
          [self.item_embeddings, self.head_embeddings]
      )  # calculate feature interactions between items and entities
  
      if user_indices is not None:
          # RS
          self.user_embeddings = self.user_embeddings_lookup(
              user_indices
          )
          self.user_embeddings = self.user_mlp(self.user_embeddings)
  
          if self.use_inner_product:  # get scores by inner product.
              self.scores = torch.sum(
                  self.user_embeddings * self.item_embeddings, 1
              )  # [batch_size]
          else:  # get scores by mlp layers
              self.user_item_concat = torch.cat(
                  [self.user_embeddings, self.item_embeddings], 1
              )  # [batch_size, emb_dim*2]
              self.user_item_concat = self.rs_mlp(self.user_item_concat)
  
              self.scores = torch.squeeze(
                  self.rs_pred_mlp(self.user_item_concat)
              )  # [batch_size]
          self.scores_normalized = torch.sigmoid(self.scores)
          outputs = [
              self.user_embeddings,
              self.item_embeddings,
              self.scores,
              self.scores_normalized,
          ]
  
      if relation_indices is not None:
          # KGE
          self.tail_embeddings = self.entity_embeddings_lookup(
              tail_indices
          )
          self.relation_embeddings = self.relation_embeddings_lookup(
              relation_indices
          )
          self.tail_embeddings = self.tail_mlp(self.tail_embeddings)
  
          self.head_relation_concat = torch.cat(
              [self.head_embeddings, self.relation_embeddings], 1
          )  # [batch_size, emb_dim*2]
          self.head_relation_concat = self.kge_mlp(
              self.head_relation_concat
          )
  
          self.tail_pred = self.kge_pred_mlp(
              self.head_relation_concat
          )  # [batch_size, 1]
          self.tail_pred = torch.sigmoid(self.tail_pred)
          self.scores_kge = torch.sigmoid(
              torch.sum(self.tail_embeddings * self.tail_pred, 1)
          )
          self.rmse = torch.mean(
              torch.sqrt(
                  torch.sum(
                      torch.pow(
                          self.tail_embeddings - self.tail_pred, 2
                      ),
                      1,
                  )
                  / self.embedding_size
              )
          )
          outputs = [
              self.head_embeddings,
              self.tail_embeddings,
              self.scores_kge,
              self.rmse,
          ]
  
      return outputs
  
file_path: RecBole/recbole/model/knowledge_aware_recommender/mkr.py
imports: import torch
  import torch.nn
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.layers import MLPLayers
  from recbole.utils import InputType
label_desc: Use image node_id 2 for calling the MKR obj's underlying member method code with example usage: obj.forward(user_indices, item_indices, head_indices, relation_indices, tail_indices) and returns: outputs