class_docstr: It is an extension of GRU4Rec, which concatenates item and its corresponding
  pre-trained knowledge graph embedding feature as the input.
class_docstr_tok: ["It","is","an","extension","of","GRU4Rec",",","which","concatenates","item","and","its","corresponding","pre-trained","knowledge","graph","embedding","feature","as","the","input","."]
code: def __init__(self, config, dataset):
      super(GRU4RecKG, self).__init__(config, dataset)
  
      # load dataset info
      self.entity_embedding_matrix = dataset.get_preload_weight(
          "ent_id"
      )
  
      # load parameters info
      self.embedding_size = config["embedding_size"]
      self.hidden_size = config["hidden_size"]
      self.num_layers = config["num_layers"]
      self.dropout = config["dropout_prob"]
      self.freeze_kg = config["freeze_kg"]
      self.loss_type = config["loss_type"]
  
      # define layers and loss
      self.item_embedding = nn.Embedding(
          self.n_items, self.embedding_size, padding_idx=0
      )
      self.entity_embedding = nn.Embedding(
          self.n_items, self.embedding_size, padding_idx=0
      )
      self.entity_embedding.weight.requires_grad = not self.freeze_kg
      self.item_gru_layers = nn.GRU(
          input_size=self.embedding_size,
          hidden_size=self.hidden_size,
          num_layers=self.num_layers,
          bias=False,
          batch_first=True,
      )
      self.entity_gru_layers = nn.GRU(
          input_size=self.embedding_size,
          hidden_size=self.hidden_size,
          num_layers=self.num_layers,
          bias=False,
          batch_first=True,
      )
      self.dense_layer = nn.Linear(
          self.hidden_size * 2, self.embedding_size
      )
      if self.loss_type == "BPR":
          self.loss_fct = BPRLoss()
      elif self.loss_type == "CE":
          self.loss_fct = nn.CrossEntropyLoss()
      else:
          raise NotImplementedError(
              "Make sure 'loss_type' in ['BPR', 'CE']!"
          )
  
      # parameters initialization
      self.apply(xavier_normal_initialization)
      self.entity_embedding.weight.data.copy_(
          torch.from_numpy(self.entity_embedding_matrix[: self.n_items])
      )
  
file_path: RecBole/recbole/model/sequential_recommender/gru4reckg.py
imports: import torch
  from torch import nn
  from recbole.model.abstract_recommender import SequentialRecommender
  from recbole.model.init import xavier_normal_initialization
  from recbole.model.loss import BPRLoss
label_desc: Use image node_id 1 to create a new GRU4RecKG object from inherited base classes: SequentialRecommender with example: obj = GRU4RecKG(config, dataset)